UB里面一块网卡能配置两个IP吗?怎么配?谢谢
-
- 帖子: 14
- 注册时间: 2006-02-16 14:33
UB里面一块网卡能配置两个IP吗?怎么配?谢谢
请问一块网卡能否配两个IP?还有就是装两块网卡可以吗?各自的IP怎么配?谢谢
- nobrain
- 帖子: 808
- 注册时间: 2005-08-25 13:58
- 来自: ustc
- 联系:
-
- 帖子: 82
- 注册时间: 2006-05-20 0:41
任何发行版本都可以是用子接口。
老的命令可以用
ifconfig
ex. ifconfig eth0:1 192.168.1.254
ifconfig eth0:2 192.168.2.254
ifconfig eth0:3 192.168.3.254
等等。
新的iproute2中可以用
ip命令.
ip add x.x.x.x dev eth1:1
。。。。。。。等等。
注意!
这两个命令操作的内涵是不一样的。不是不兼容的意思,只是会互相有影响。从系统的角度来看,我建议你是用ip命令。ifconfig太老久,操作的内核钩子不合理。
如果配合vconfig,可以更进一步实现基于vlan标记dotlq子接口。这个功能被大量用于trunking单臂路由。只要堆栈允许你可以设置65535个子接口。(实际使用中,一般还有限制,不过肯定是足够用的。这还与其他内核配置有关系。)
至于,多网卡。这个更容易了。只要你能插,多少都可以。
我最多实现过16lan(4块4lan网卡)。这不是内核的理论最大,只是硬件最大。
你还可以在每个lan口上配置多个ip。只要你高兴。
老的命令可以用
ifconfig
ex. ifconfig eth0:1 192.168.1.254
ifconfig eth0:2 192.168.2.254
ifconfig eth0:3 192.168.3.254
等等。
新的iproute2中可以用
ip命令.
ip add x.x.x.x dev eth1:1
。。。。。。。等等。
注意!
这两个命令操作的内涵是不一样的。不是不兼容的意思,只是会互相有影响。从系统的角度来看,我建议你是用ip命令。ifconfig太老久,操作的内核钩子不合理。
如果配合vconfig,可以更进一步实现基于vlan标记dotlq子接口。这个功能被大量用于trunking单臂路由。只要堆栈允许你可以设置65535个子接口。(实际使用中,一般还有限制,不过肯定是足够用的。这还与其他内核配置有关系。)
至于,多网卡。这个更容易了。只要你能插,多少都可以。
我最多实现过16lan(4块4lan网卡)。这不是内核的理论最大,只是硬件最大。
你还可以在每个lan口上配置多个ip。只要你高兴。
- firehare
- 帖子: 2625
- 注册时间: 2005-04-10 16:54
- 来自: 温州大学
- 联系:
- eexpress
- 帖子: 58428
- 注册时间: 2005-08-14 21:55
- 来自: 长沙
记录,留影,纪念,保留
代码: 全选
ifconfig eth0:1 192.168.1.254
ifconfig eth0:2 192.168.2.254
ifconfig eth0:3 192.168.3.254
ip add x.x.x.x dev eth1:1
● 鸣学
-
- 帖子: 82
- 注册时间: 2006-05-20 0:41
-
- 帖子: 315
- 注册时间: 2005-05-11 20:14
- 来自: 西安理工大学
单网卡,如何设置双ip??
我在家申请了网通的宽带,还连接了校园网。
校园网太慢了,主要以网通为主,还要能访问教学区的资源,所以,将两个网络连到一个交换机上,
首先要做的是设置两个IP地址。
打开配置文件
sudo nano /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
address 127.0.0.1
netmask 255.0.0.0
# This is a list of hotpluggable network interfaces.
# They will be activated automatically by the hotplug subsystem.
auto eth0
# The primary network interface
iface eth0 inet static
address 192.168.160.100
netmask 255.255.255.0
gateway 192.168.160.1
从这里开始增加
auto eth0:0
#insert by myself
iface eth0:0 inet static
address 219.244.87.100
netmask 255.255.255.0
保存后,重新启动
sudo /etc/init.d/networking restart
这是在Ubuntu6.06下测试成功的。
接下来,还要实验路由表的设置。
我在家申请了网通的宽带,还连接了校园网。
校园网太慢了,主要以网通为主,还要能访问教学区的资源,所以,将两个网络连到一个交换机上,
首先要做的是设置两个IP地址。
打开配置文件
sudo nano /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
address 127.0.0.1
netmask 255.0.0.0
# This is a list of hotpluggable network interfaces.
# They will be activated automatically by the hotplug subsystem.
auto eth0
# The primary network interface
iface eth0 inet static
address 192.168.160.100
netmask 255.255.255.0
gateway 192.168.160.1
从这里开始增加
auto eth0:0
#insert by myself
iface eth0:0 inet static
address 219.244.87.100
netmask 255.255.255.0
保存后,重新启动
sudo /etc/init.d/networking restart
这是在Ubuntu6.06下测试成功的。
接下来,还要实验路由表的设置。
-
- 帖子: 315
- 注册时间: 2005-05-11 20:14
- 来自: 西安理工大学