[问题] 如何配置一块网卡多个IP地址

Web、Mail、Ftp、DNS、Proxy、VPN、Samba、LDAP 等基础网络服务
回复
头像
wdb2005
帖子: 92
注册时间: 2007-02-23 18:45

[问题] 如何配置一块网卡多个IP地址

#1

帖子 wdb2005 » 2007-08-07 10:29

请问如何在一块网卡上配置多个IP地址,另外在字符界面下如何配置网关

例如,在网卡ETH0上配置IP 地址分别为192.168.1.101和192.168.1.121,子网掩码:255.255.255.0,网关:192.168.1.1 DNS:192.168.1.2 具体命令是? 谢谢
hjc9246
帖子: 44
注册时间: 2007-07-25 20:00
联系:

#2

帖子 hjc9246 » 2007-08-09 0:15

sudo nano /etc/network/interfaces

auto eth0 eth0:1
iface eth0 inet static
address 192.168.1.101
netmask 255.255.255.0
gateway 192.168.1.1

iface eth0:1 inet static
address 192.168.1.121
netmask 255.255.255.0


好像是这样.
hjc9246
帖子: 44
注册时间: 2007-07-25 20:00
联系:

#3

帖子 hjc9246 » 2007-08-09 0:16

对了.完了要重启服务
sudo /etc/init.d/networking restart
头像
wdb2005
帖子: 92
注册时间: 2007-02-23 18:45

#4

帖子 wdb2005 » 2007-08-20 9:57

首先谢谢hjc9246先生的回答,谁能帮我解释一下这几行的意思。

代码: 全选

sudo nano /etc/network/interfaces 

auto eth0 eth0:1 
iface eth0 inet static 
address 192.168.1.101
netmask 255.255.255.0
gateway 192.168.1.1

代码: 全选

iface eth0:1 inet static 
address 192.168.1.121
netmask 255.255.255.0
头像
alextu
帖子: 2
注册时间: 2007-07-27 16:50

#5

帖子 alextu » 2007-08-24 8:56

我现在测试机器上的代理就是这么设置的。
static表示你自己固定的静态IP,你可以去WIKI上面查找一下
cyberhover
帖子: 25
注册时间: 2006-09-21 21:42

#6

帖子 cyberhover » 2007-09-03 21:16

ifconfig eth0 192.168.1.101 netmask 255.255.255.0
ifconfig eth0 add 192.168.1.121 netmask 255.255.255.0
ip route add to all via 192.168.1.1

编辑/etc/resolv.conf文件,加入一行:
nameserver 192.168.1.2
头像
wdb2005
帖子: 92
注册时间: 2007-02-23 18:45

#7

帖子 wdb2005 » 2008-03-14 9:48

谢谢了,顶起来,看看还有哪位高手指点一下
回复