文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>如何在一块网卡绑定多个ip

如何在一块网卡绑定多个ip

时间:2007-04-05  来源:amoooo

需求:linux as 4.2系统下实现一个网卡可以网管多个ip段的设备(多个ip段都在同一个vlan中)
分析:实现这个需要在一块网卡上面绑定多个网段的ip
解决:
1、增加一个虚拟的网卡文件
cd /etc/sysconfig/network-scripts/
cp ifcfg-eth1 ifcfg-eth1:0
2、编辑eth1:0,改变其中的ip地址、设备名称等信息
vi ifcfg-eth1:0
# Broadcom Corporation NetXtreme BCM5721 Gigabit Ethernet PCI Express
DEVICE=eth1:0 #这里更改为新的虚拟设备名称
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.x.250 #这里更改为新网段的ip
NETMASK=255.255.255.0
HWADDR=00:17:x.x:B1:C1 #这里不能更改
然后保存ifcfg-eth1:0文件
3、重启网络服务
[root@xxxx network-scripts]# service network restart
Shutting down interface eth0:                              [  OK  ]
Shutting down interface eth1:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Setting network parameters:                                [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:                                [  OK  ]
Bringing up interface eth1:                                [  OK  ]
4、测试
[root@xxxx network-scripts]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.x.x.0    *               255.255.255.0   U     0      0        0 eth1
172.x.x.0     *               255.255.255.0   U     0      0        0 eth0
192.168.x.0   *               255.255.255.0   U     0      0        0 eth1
default         172.x.x.1     0.0.0.0         UG    0      0        0 eth0
[root@xxxx network-scripts]# ping 10.x.x.250
PING 10.254.254.250 (10.254.254.250) 56(84) bytes of data.
64 bytes from 10.x.x.250: icmp_seq=0 ttl=64 time=0.023 ms
64 bytes from 10.x.x.250: icmp_seq=1 ttl=64 time=0.013 ms
--- 10.254.254.250 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.013/0.018/0.023/0.005 ms, pipe 2
[root@xxxx network-scripts]# ping 192.168.x.7
PING 192.168.x.7 (192.168.200.7) 56(84) bytes of data.
64 bytes from 192.168.x.7: icmp_seq=0 ttl=30 time=2.67 ms
64 bytes from 192.168.x.7: icmp_seq=1 ttl=30 time=0.680 ms
--- 192.168.200.7 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 0.680/1.675/2.670/0.995 ms, pipe 2
[root@xxxx network-scripts]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:18:FE:79:31:E3 
          inet addr:172.x.x.2  Bcast:172.x.x.255  Mask:255.255.255.0
          inet6 addr: fe80::218:feff:fe79:31e3/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:165 errors:0 dropped:0 overruns:0 frame:0
          TX packets:142 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:14086 (13.7 KiB)  TX bytes:21278 (20.7 KiB)
          Interrupt:177
eth1      Link encap:Ethernet  HWaddr 00:17:08:56:B1:C1 
          inet addr:10.x.x.250  Bcast:10.x.x.255  Mask:255.255.255.0
          inet6 addr: fe80::217:8ff:fe56:b1c1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:351 errors:0 dropped:0 overruns:0 frame:0
          TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:27333 (26.6 KiB)  TX bytes:1190 (1.1 KiB)
          Interrupt:169
eth1:0    Link encap:Ethernet  HWaddr 00:17:08:56:B1:C1 
          inet addr:192.168.x.250  Bcast:192.168.x.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:169
相关阅读 更多 +
排行榜 更多 +
2399玩游盒

2399玩游盒

游戏工具 下载
悦邻人人播

悦邻人人播

商务办公 下载
棘龙模拟器

棘龙模拟器

音乐节奏 下载