配置虚拟主机时有一种方式是在一块网卡上绑定多个IP,操作如下:
首先用ifconfig查看物理网卡
[root@localhost etc]# ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:98:1C:2E
inet addr:192.168.1.103 Bcast:255.255.255.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe98:1c2e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:59217 errors:0 dropped:0 overruns:0 frame:0
TX packets:45034 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:24197483 (23.0 MiB) TX bytes:7882365 (7.5 MiB)
Interrupt:10 Base address:0xd020
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:62 errors:0 dropped:0 overruns:0 frame:0
TX packets:62 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:8325 (8.1 KiB) TX bytes:8325 (8.1 KiB)
lo是本地回环
eh开头的是物理网卡,我只有一块网卡,所以显示eth0
那么现在我们在eth0上绑定其他IP地址
[root@localhost etc]# ifconfig eth0:1 192.168.1.201 netmask 255.255.255.0 up
[root@localhost etc]# route add -host 192.168.1.201 dev eth0:1
[root@localhost etc]#
[root@localhost etc]# ifconfig eth0:2 192.168.1.202 netmask 255.255.255.0 up
[root@localhost etc]# route add -host 192.168.1.202 dev eth0:2
eth0:n 这里的n可以自己随便设置
route 为新地址添加路由并且绑定在相应的eth0:n上
ok,现在在其他机器上ping一下,因该已经通了:)
注意:
1.这里绑定的其他IP,会在机器重启时消失,如果想永久绑定,就需要在开机时写一个shell,把上边的shell贴在:(/etc/rc.local)文件里就OK了:)
2.删除绑定IP:
[root@localhost etc]# ifconfig eth0:1 down
[root@localhost etc]# ifconfig eth0:2 down
3.删除路由(如果已经删除绑定IP,路由会自动消失)
[root@localhost etc]# route del 192.168.1.201 dev eth0:1
[root@localhost etc]# route del 192.168.1.202 dev eth0:2
分享到:
相关推荐
一块网卡绑定多个IP地址.EXE一块网卡绑定多个IP地址.EXE
双网卡bonding技术是两块网卡绑定同一个IP,是进行双网络热备的一个成熟方案。
本文介绍了在Linux系统中为单网卡绑定多IP与多网卡共用单IP的方法。
由于Windows电脑是图形化界面,单网卡配置多个IP地址很容易,并且网上教程比较多。然而Linux一般都是用命令行配置IP地址,Linux版本较多,对于CentOS系统而言,CentOS6和CentOS7的很多命令都不一样。本文是对CentOS7...
为linux虚拟机一个网卡分配多个IP地址, 而且有图啊,很有用,本人自己做的
linux双网卡绑定 bonding
linux下多网卡绑定相同IP攻略,加强性能体验
solaris10系统如何绑定多个IP,可以按照这个文档完成在1张网卡上绑定多个IP地址的操作。
在linux系统中一块网卡上配置多个ip
linux双网卡绑定
linux6.4双网卡绑定,详细讲述如何在Linux系统中实现双网卡的绑定。
该文档是介绍在linux下做双网卡做绑定的配置举例
双网卡绑定:Linux下双网卡绑定技术实现网卡负载均衡
linux双网卡bond绑定,实现主备,负载均衡
可用于在程序中单网卡绑定多IP,程序退出时可删除应用程序绑定的IP.
linux双网卡 路由配置 访问特定ip网段走指定网卡,命令已实测
本文介绍的Linux双网卡绑定实现就是使用两块网卡虚拟成为一块网卡,这个聚合起来的 设备看起来是一个单独的以太网接口设备,通俗点讲就是两块网卡具有相同的IP地址而并行链接聚合成一个逻辑链路工作。其实这项技术在...
Lininux,网inux,网卡,多网卡inux,网卡,多网卡
linux双网卡绑定详细讲解 linux网卡的的设定 linux双网卡的绑定
大家赚积分不容易,随便收个1分吧! 你们的支持是我最大的动力~