你好,游客 登录 注册 搜索
背景:
阅读新闻

Linux系统单网卡绑定多个IP地址

[日期:2013-03-21] 来源:Linux社区  作者:yanghuawu [字体:大 中 小]

4、配置网卡DNS(电信和联通)

配置文件在/etc/resolv.conf下面。

vim /etc/resolv.conf

nameserver 202.109.14.5 #主DNS

nameserver 219.141.136.10 #次DNS

 

保存退出,然后运行如下的命令,重启虚拟的网卡。

[root@localhost network-scripts]# service network restart或/etc/init.d/network restart

 

5、我们来查看我们虚拟的网卡是不是激活了,用ifconfig,也就是下面这样的。

[root@localhost network-scripts]# ifconfig

eth0 Link encap:Ethernet HWaddr 00:0C:29:C9:6D:18

inet addr:116.18.176.19 Bcast:192.168.1.255 Mask:255.255.255.0

inet6 addr: fe80::20c:29ff:fec9:6d18/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:1622 errors:0 dropped:0 overruns:0 frame:0

TX packets:702 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:170181 (166.1 KiB) TX bytes:122357 (119.4 KiB)

 

eth0:0 Link encap:Ethernet HWaddr 00:0C:29:C9:6D:18

inet addr:172.188.174.20 Bcast:192.168.1.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:0 errors:0 dropped:0 overruns:0 frame:0

TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

  

6、下面测试一下,另外一台计算机使用ping来测试

C:\Users\Administrator>ping 116.18.176.19

正在 Ping 116.18.176.19 具有 32 字节的数据:

来自 116.18.176.19 的回复: 字节=32 时间=16ms TTL=64

来自 116.18.176.19 的回复: 字节=32 时间=8ms TTL=255

来自 116.18.176.19 的回复: 字节=32 时间=8ms TTL=255

来自 116.18.176.19 的回复: 字节=32 时间=8ms TTL=255

 

C:\Users\Administrator>ping 172.188.174.20

正在 Ping 172.188.174.20 具有 32 字节的数据:

来自 172.188.174.20 的回复: 字节=32 时间=16ms TTL=64

来自 172.188.174.20 的回复: 字节=32 时间=8ms TTL=255

来自 172.188.174.20 的回复: 字节=32 时间=8ms TTL=255

来自 172.188.174.20 的回复: 字节=32 时间=8ms TTL=255

 

测试成功!

 

7、测试当eth0 网络中断eth0:0是否正常使用

C:\Users\Administrator>ping 116.18.176.19

正在 Ping 116.18.176.19 具有 32 字节的数据:

请求超时。

请求超时。

请求超时。

来自 192.168.1.2 的回复: 无法访问目标主机。

 

C:\Users\Administrator>ping 172.188.174.20

正在 Ping 172.188.174.20 具有 32 字节的数据:

来自 172.188.174.20 的回复: 字节=32 时间=16ms TTL=64

来自 172.188.174.20 的回复: 字节=32 时间=8ms TTL=255

来自 172.188.174.20 的回复: 字节=32 时间=8ms TTL=255

来自 172.188.174.20 的回复: 字节=32 时间=8ms TTL=255

 

测试成功!

linux
相关资讯       Linux 网卡多ip 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款