虚拟机做网关实现局域网上网
时间:2009-03-23 来源:sjhf
通过ADSL没有路由的功能,其中的一个上网.形成一个小型局域网上网的模型.
首先要保证linux配置adsl帐号
INTERFACE
Enter the Ethernet interface connected to the ADSL modem
For Solaris, this is likely to be something like /dev/hme0.
For Linux, it will be ethX, where 'X' is a number.
(default eth0): 直接回车即可
DNS
Please enter the IP address of your ISP's primary DNS server.
If your ISP claims that 'the server will provide dynamic DNS addresses',
enter 'server' (all lower-case) here.
If you just press enter, I will assume you know what you are
doing and not modify your DNS setup.
Enter the DNS information here: 如果是由ADSL的密码
Please re-enter your Password: 是否启用防火墙,0默认是否
** Summary of what you entered ** 开始拨号
[root@localhost root]# adsl-start
外网域名
[root@localhost root]# ping www.baidu.com
PING www.a.shifen.com (220.181.37.4) 56(84) bytes of data.
64 bytes from 220.181.37.4: icmp_seq=1 ttl=52 time=100 ms
64 bytes from 220.181.37.4: icmp_seq=2 ttl=52 time=102 ms
查看当前路由信息
[root@localhost root]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
59.175.102.1 * 255.255.255.255 UH 0 0 0 ppp0
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
169.254.0.0 * 255.255.0.0 U 0 0 0 eth0
127.0.0.0 * 255.0.0.0 U 0 0 0 lo
default 59.175.102.1 0.0.0.0 UG 0 0 0 ppp0
实现内外网的路由和NAT的网关设为linux的DNS,上上网了.
并没有使用iptables.只需要使用echo 1 > /proc/sys/net/ipv4/ip_forward客户xp1.11通1.13只是单纯的路由转发,所以需要使用iptables.
记得每次修改IP设置之后要重启网卡,并且重新启动转发
echo 1 > /proc/sys/net/ipv4/ip_forward
虚拟机网关的实验后,中连接adsl,密码错误.只能重启看看了,发现在选择系统的那个地方停住了,害怕,难道要重新装系统??还是觉得不甘心,把插着的U不由得长嘘一口气,不过实验几次后发现确实有这个问题,连接会报域上的用户名/重启了.
|
相关阅读 更多 +
排行榜 更多 +