一块网卡绑定多个ip,在单一网卡服务器上运行多个基于ip的虚拟主机 2011-07-26 14:07 一片温柔 阅读(275) 评论(0) 编辑 收藏 举报 1、查看服务器ip地址 [root@localhost ~]# ifconfig eth0 Link encap:Ethernet HWaddr 08:00:27:AF:48:0C inet addr:192.168.52.77 Bcast:192.168.52.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:feaf:480c/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1388 errors:0 dropped:0 overruns:0 frame:0 TX packets:107 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:211513 (206.5 KiB) TX bytes:14840 (14.4 KiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:8 errors:0 dropped:0 overruns:0 frame:0 TX packets:8 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:560 (560.0 b) TX bytes:560 (560.0 b) 2、使用ifconfig和route命令,添加ip192.168.52.52 [root@localhost ~]# /sbin/ifconfig eth0:1 192.168.52.52 broadcast 192.168.52.255 netmask 255.255.255.0 up [root@localhost ~]# /sbin/route add -host 192.168.52.52 dev eth0:1 3、查看ip地址 [root@localhost ~]# ifconfig eth0 Link encap:Ethernet HWaddr 08:00:27:AF:48:0C inet addr:192.168.52.77 Bcast:192.168.52.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:feaf:480c/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:2375 errors:0 dropped:0 overruns:0 frame:0 TX packets:497 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:333097 (325.2 KiB) TX bytes:62992 (61.5 KiB) eth0:1 Link encap:Ethernet HWaddr 08:00:27:AF:48:0C inet addr:192.168.52.52 Bcast:192.168.52.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:8 errors:0 dropped:0 overruns:0 frame:0 TX packets:8 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:560 (560.0 b) TX bytes:560 (560.0 b) 4、移除虚拟ip [root@localhost ~]# /sbin/ifconfig eth0:1 192.168.52.52 broadcast 192.168.52.255 netmask 255.255.255.0 down 相关文章: 2021-10-05 2021-07-30 2022-12-23 2021-11-18 2021-12-13 2021-09-28 2021-07-05 2022-01-24