LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1232|回复: 6

关于单网卡双ip的问题

[复制链接]
发表于 2004-6-17 19:28:31 | 显示全部楼层 |阅读模式
现在有一块网卡,一个固定的ip 172.18.x.x,还有一个通过pppoe得到的动态ip:172.31.x.x
固定ip只能访问内网,ppp的ip只能访问外网
网卡设备是eth0,ppp的设备是ppp0,把固定的ip绑在eth0上,然后重启network service,用ifconfig查看,发现ppp0的ip没有变化,还是172.31.x.x,但是外网却已经不通了

有没有办法让这两个ip同时起作用?

系统:fc2
发表于 2004-6-17 20:29:38 | 显示全部楼层
route -n
的输出写出来看看
 楼主| 发表于 2004-6-17 20:44:10 | 显示全部楼层
未绑定固定ip时的
[root@inferno user]# /sbin/ifconfig
eth0      Link encap:Ethernet  HWaddr 00:E0:4C:62:44:F3
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:22662 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10443 errors:0 dropped:0 overruns:0 carrier:0
          collisions:2529 txqueuelen:1000
          RX bytes:11107602 (10.5 Mb)  TX bytes:1580599 (1.5 Mb)
          Interrupt:11 Base address:0x1000

lo        Link encapocal Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:27438 errors:0 dropped:0 overruns:0 frame:0
          TX packets:27438 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:4798266 (4.5 Mb)  TX bytes:4798266 (4.5 Mb)

ppp0      Link encapoint-to-Point Protocol
          inet addr:172.31.0.77  P-t-P:24.24.24.24  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1492  Metric:1
          RX packets:8393 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8149 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3
          RX bytes:7709185 (7.3 Mb)  TX bytes:1155801 (1.1 Mb)


[root@inferno user]# /sbin/route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
24.24.24.24     0.0.0.0         255.255.255.255 UH    0      0        0 ppp0
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 lo
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         24.24.24.24     0.0.0.0         UG    0      0        0 ppp0


绑定固定ip后的
[root@inferno user]# /sbin/ifconfig
eth0      Link encap:Ethernet  HWaddr 00:E0:4C:62:44:F3
          inet addr:172.18.57.123  Bcast:172.18.57.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:22858 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10475 errors:0 dropped:0 overruns:0 carrier:0
          collisions:2537 txqueuelen:1000
          RX bytes:11131094 (10.6 Mb)  TX bytes:1582799 (1.5 Mb)
          Interrupt:11 Base address:0x1000

lo        Link encapocal Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:27440 errors:0 dropped:0 overruns:0 frame:0
          TX packets:27440 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:4798366 (4.5 Mb)  TX bytes:4798366 (4.5 Mb)

ppp0      Link encapoint-to-Point Protocol
          inet addr:172.31.0.77  P-t-P:24.24.24.24  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1492  Metric:1
          RX packets:8413 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8169 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3
          RX bytes:7710225 (7.3 Mb)  TX bytes:1156841 (1.1 Mb)


[root@inferno user]# /sbin/route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
24.24.24.24     0.0.0.0         255.255.255.255 UH    0      0        0 ppp0
172.18.57.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth0
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         172.18.57.253   0.0.0.0         UG    0      0        0 eth0
 楼主| 发表于 2004-6-17 20:45:28 | 显示全部楼层
我发现如果先起动eth0,再ppp拨号,有时侯可以两个ip同时使用,有时侯就不行
发表于 2004-6-17 21:06:21 | 显示全部楼层
两个是不同的设备。应该可以分开的吧。
发表于 2004-6-18 00:35:37 | 显示全部楼层
eth0伴随一起启动,再启动ppp0还会吗 ?

添加route表
发表于 2004-6-18 08:16:24 | 显示全部楼层
eth0不变
modprobe dummy
增加一个虚拟网卡。
不要设置dummy0的网关,IP。
修改ADSL-SETUP连接的网卡为dummy0
应该就行了。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表