当前位置: 我爱LAMP > LAMP, Linux > 文章正文

Linux操作系统下用单网卡捆绑双IP的方法

发表于 2009-07-19 10:03    文章来源:互联网

1、配置第一个IP地址:

[root@Linux root]#cd /etc/sysconfig/network-scripts

[root@Linux network-scripts]#vi ifcfg-eth0

DEVICE=eth0

BOOTPROTO=static

BROADCAST=192.168.80.255 //*广播地址*//

IPADDR=192.168.80.189 //*第一个IP地址*//

NETMASK=255.255.255.0 //*网络掩码*//

NETWORK=192.168.80.0 //*所在网段*//

ONBOOT=yes

:wq //*保存退出*//

http://www.52lamp.com.cn
2、复制第一个IP地址配置文件为第二个IP地址配置文件,并修改里面的IP地址:

[root@Linux network-scripts]#cp ifcfg-eth0 ifcfg-eth1

[root@Linux network-scripts]#vi ifcfg-eth1

DEVICE=eth0

BOOTPROTO=static

BROADCAST=192.168.80.255 //*广播地址*//

IPADDR=192.168.80.199 //*第二个IP地址*//

NETMASK=255.255.255.0 //*网络掩码*//

NETWORK=192.168.80.0 //*所在网段*//

ONBOOT=yes

:wq //*保存退出*//
3、重启网卡:

[root@Linux network-scripts]#service network restart

或:

[root@Linux network-scripts]#ifdown eth0

[root@Linux network-scripts]#ifup eth0

[root@Linux network-scripts]#ifconfig eth0 down

[root@Linux network-scripts]#ifconfig eth0 up

本文链接: http://www.52lamp.com.cn/detail/1018.html

喜欢我爱LAMP – lamp开发程序交流学习平台的文章,那就通过 RSS Feed 功能订阅阅读吧!