CentOS 7阿里云服务器IP地址和MAC地址绑定
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了CentOS 7阿里云服务器IP地址和MAC地址绑定,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3281字,纯文字阅读大概需要5分钟。
内容图文
![CentOS 7阿里云服务器IP地址和MAC地址绑定](/upload/InfoBanner/zyjiaocheng/959/aa581b51ace54f99877687e625915ef0.jpg)
在CentOS 7阿里云服务器把IP地址和MAC地址绑定,网上起初搜索到的方法都不行。以下是后来根据报错搜索到的结果。
其实,到底有没有绑定成功我也不太确定。虽然,执行“arp”命令、“arp -a”命令都能找到绑定记录,但我还是不放心。
[root@iZ236166figZ ~]# ifconfig docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 inet 192.168.0.1 netmask 255.255.240.0 broadcast 0.0.0.0 ether 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 0 TX packets 130887 bytes 195002426 (185.9 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 10.253.43.165 netmask 255.255.248.0 broadcast 10.253.47.255 ether 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 0 TX packets 589976960 bytes 480870664184 (447.8 GiB) TX errors 0 dropped 11 overruns 0 carrier 0 collisions 0 eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 118.178.12.16 netmask 255.255.254.0 broadcast 118.178.13.255 ether 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 0 TX packets 48853685 bytes 27799365139 (25.8 GiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 loop txqueuelen 0 (Local Loopback) RX packets 12958790 bytes 832306490 (793.7 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX 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文件一般需要增加执行权限,才能在重启服务器后,运行里面的命令。
[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地址绑定全部内容,希望文章能够帮你解决CentOS 7阿里云服务器IP地址和MAC地址绑定所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。