日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

CentOS 7阿里云服务器IP地址和MAC地址绑定

發(fā)布時間:2024/1/1 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 CentOS 7阿里云服务器IP地址和MAC地址绑定 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

  在CentOS 7阿里云服務器把IP地址和MAC地址綁定,網(wǎng)上起初搜索到的方法都不行。以下是后來根據(jù)報錯搜索到的結果。

  其實,到底有沒有綁定成功我也不太確定。雖然,執(zhí)行“arp”命令、“arp -a”命令都能找到綁定記錄,但我還是不放心。

[root@iZ236166figZ?~]#?ifconfig docker0:?flags=4099<UP,BROADCAST,MULTICAST>??mtu?1500inet?192.168.0.1??netmask?255.255.240.0??broadcast?0.0.0.0ether?02:42:c4:da:39:9e??txqueuelen?0??(Ethernet)RX?packets?90553??bytes?9116677?(8.6?MiB)RX?errors?0??dropped?0??overruns?0??frame?0TX?packets?130887??bytes?195002426?(185.9?MiB)TX?errors?0??dropped?0?overruns?0??carrier?0??collisions?0eth0:?flags=4163<UP,BROADCAST,RUNNING,MULTICAST>??mtu?1500inet?10.253.43.165??netmask?255.255.248.0??broadcast?10.253.47.255ether?00:16:3e:00:0d:b7??txqueuelen?1000??(Ethernet)RX?packets?1705153533??bytes?384820555809?(358.3?GiB)RX?errors?0??dropped?0??overruns?0??frame?0TX?packets?589976960??bytes?480870664184?(447.8?GiB)TX?errors?0??dropped?11?overruns?0??carrier?0??collisions?0eth1:?flags=4163<UP,BROADCAST,RUNNING,MULTICAST>??mtu?1500inet?118.178.12.16??netmask?255.255.254.0??broadcast?118.178.13.255ether?00:16:3e:00:07:5e??txqueuelen?1000??(Ethernet)RX?packets?5530935427??bytes?256025183196?(238.4?GiB)RX?errors?0??dropped?0??overruns?0??frame?0TX?packets?48853685??bytes?27799365139?(25.8?GiB)TX?errors?0??dropped?0?overruns?0??carrier?0??collisions?0lo:?flags=73<UP,LOOPBACK,RUNNING>??mtu?65536inet?127.0.0.1??netmask?255.0.0.0loop??txqueuelen?0??(Local?Loopback)RX?packets?12958790??bytes?832306490?(793.7?MiB)RX?errors?0??dropped?0??overruns?0??frame?0TX?packets?12958790??bytes?832306490?(793.7?MiB)TX?errors?0??dropped?0?overruns?0??carrier?0??collisions?0

  綁定IP地址和MAC地址:

[root@iZ236166figZ?~]#?arp?-s?10.253.43.165?-H?ether?00:16:3e:00:0d:b7?-i?eth0 [root@iZ236166figZ?~]#?arp?-s?118.178.12.16?-H?ether?00:16:3e:00:07:5e?-i?eth1

  加入開機自啟動項:

[root@iZ236166figZ?~]#?echo?"arp?-s?10.253.43.165?-H?ether?00:16:3e:00:0d:b7?-i?eth0"?>>/etc/rc.local [root@iZ236166figZ?~]#?echo?"arp?-s?118.178.12.16?-H?ether?00:16:3e:00:07:5e?-i?eth1"?>>/etc/rc.local [root@iZ236166figZ?~]#?cat?/etc/rc.local? #!/bin/bash #?THIS?FILE?IS?ADDED?FOR?COMPATIBILITY?PURPOSES # #?It?is?highly?advisable?to?create?own?systemd?services?or?udev?rules #?to?run?scripts?during?boot?instead?of?using?this?file. # #?In?contrast?to?previous?versions?due?to?parallel?execution?during?boot #?this?script?will?NOT?be?run?after?all?other?services. # #?Please?note?that?you?must?run?'chmod?+x?/etc/rc.d/rc.local'?to?ensure #?that?this?script?will?be?executed?during?boot.touch?/var/lock/subsys/local arp?-s?10.253.43.165?-H?ether?00:16:3e:00:0d:b7?-i?eth0 arp?-s?118.178.12.16?-H?ether?00:16:3e:00:07:5e?-i?eth1

  CentOS 7之后,/etc/rc.local文件一般需要增加執(zhí)行權限,才能在重啟服務器后,運行里面的命令。

[root@iZ236166figZ?~]#?ll?/etc/rc.d/rc.local? -rw-r--r--?1?root?root?585?Aug??5?14:51?/etc/rc.d/rc.local [root@iZ236166figZ?~]#?chmod?+x?/etc/rc.d/rc.local? [root@iZ236166figZ?~]#?ll?/etc/rc.d/rc.local??????? -rwxr-xr-x?1?root?root?585?Aug??5?14:51?/etc/rc.d/rc.local


總結

以上是生活随笔為你收集整理的CentOS 7阿里云服务器IP地址和MAC地址绑定的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內容還不錯,歡迎將生活随笔推薦給好友。