免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 5043 | 回复: 11
打印 上一主题 下一主题

[VMware] vmware配置nat [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-03-23 19:41 |只看该作者 |倒序浏览
请教各位大虾:
网络环境:
winenxp +VMware(LINUX)
想做一个如下的试验:
VM(linux)作Nat 拨号adsl ,xp通过linux上网
请教各位
vmware中我需要设定两个网卡,还是绑定两个ip即可
请各位指教

论坛徽章:
0
2 [报告]
发表于 2006-03-23 19:49 |只看该作者
vmware 的网卡设置成 bridge 模式
eth0 配置一个 LAN IP
借助 eth0 进行 ADSL 拨号,获得 ppp0 设备
用 iptables 针对某些 IP 做 MASQUERADE 就可以了

论坛徽章:
0
3 [报告]
发表于 2006-03-23 19:52 |只看该作者
原帖由 platinum 于 2006-3-23 19:49 发表
vmware 的网卡设置成 bridge 模式
eth0 配置一个 LAN IP
借助 eth0 进行 ADSL 拨号,获得 ppp0 设备
用 iptables 针对某些 IP 做 MASQUERADE 就可以了

感谢回复
那么xp通过什么设备连接到linux呢? 如果仅有一个eth0设备

论坛徽章:
0
4 [报告]
发表于 2006-03-24 12:26 |只看该作者
原帖由 qmailer 于 2006-3-23 19:41 发表
请教各位大虾:
网络环境:
winenxp +VMware(LINUX)
想做一个如下的试验:
VM(linux)作Nat 拨号adsl ,xp通过linux上网
请教各位
vmware中我需要设定两个网卡,还是绑定两个ip即可
请各位指教

目前的拥有的设备

xp +  VMware
想要实现的网络结构为
  1. internet<----adsl ---> linux (NAT)  <-----xp
复制代码

我还要添加什么设备呢,vmware 一个网卡可以搞定吗?

论坛徽章:
0
5 [报告]
发表于 2006-03-25 00:17 |只看该作者
up

论坛徽章:
0
6 [报告]
发表于 2006-03-25 06:48 |只看该作者
前面 platinum 兄不是已经很清楚告诉你作法了 ?


  1. vmware 的网卡设置成 bridge 模式
  2. eth0 配置一个 LAN IP
  3. 借助 eth0 进行 ADSL 拨号,获得 ppp0 设备
  4. 用 iptables 针对某些 IP 做 MASQUERADE 就可以了
复制代码


先确认你选 bridge 网路模式给 linux 使用,这样才会正确。

linux eth0 网路卡配置为 192.168.100.254/24,你设定好 adsl pppoe 时,透过 eth0 当中介进而拨接成功得到 ppp0,该 ppp0 是 isp 给您的 ip 配置。

windows 那边,实际那个网路卡 ip 改成 192.168.100.1/24,然后 default gw 指向 192.168.100.254 即可。剩下的 dns 你就指向 isp 的 dns server ip 就好。

最后需要 iptables 配置,一般主要 rule 如下 (简化的叙述,提供参考用)


  1. echo 1 > /proc/sys/net/ip_forward
  2. iptables -P FORWARD ACCEPT
  3. iptables -F FORWARD
  4. iptables -A POSTROUTING -t nat -s 192.168.100.0/24 -o ppp+ -j MASQUERADE
复制代码


==

[ 本帖最后由 kenduest 于 2006-3-25 07:00 编辑 ]

论坛徽章:
0
7 [报告]
发表于 2006-03-25 09:46 |只看该作者
绑定两个ip即可

论坛徽章:
0
8 [报告]
发表于 2006-03-25 09:48 |只看该作者
那么xp通过什么设备连接到linux呢? 如果仅有一个eth0设备

把WIN的IP设置成和LINUX在同一个网段,然后GW指向LINUX即可。

论坛徽章:
0
9 [报告]
发表于 2006-03-25 16:57 |只看该作者
请教各位大虾
VMware_linux拨号时,没有成功
执行
  1. #ifconfig
  2.     ppp1      Link encap:Point-to-Point Protocol  
  3.           inet addr:10.112.112.112  P-t-P:10.112.112.113  Mask:255.255.255.255
  4.           UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1492  Metric:1
  5.           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
  6.           TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
  7.           collisions:0 txqueuelen:3
  8.           RX bytes:0 (0.0 b)  TX bytes:40 (40.0 b)

  9. ppp2      Link encap:Point-to-Point Protocol  
  10.           inet addr:10.112.112.112  P-t-P:10.112.112.113  Mask:255.255.255.255
  11.           UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1492  Metric:1
  12.           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
  13.           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
  14.           collisions:0 txqueuelen:3
  15.           RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

  16. ppp3      Link encap:Point-to-Point Protocol  
  17.           inet addr:10.112.112.112  P-t-P:10.112.112.113  Mask:255.255.255.255
  18.           UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1492  Metric:1
  19.           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
  20.           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
  21.           collisions:0 txqueuelen:3
  22.           RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

  23. ppp4      Link encap:Point-to-Point Protocol  
  24.           inet addr:10.112.112.112  P-t-P:10.112.112.113  Mask:255.255.255.255
  25.           UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1492  Metric:1
  26.           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
  27.           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
  28.           collisions:0 txqueuelen:3
  29.           RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
复制代码

请教各位,怎么会出现 ppp1~ppp4

论坛徽章:
0
10 [报告]
发表于 2006-03-26 04:52 |只看该作者
當然有撥接成功,要不然不會有 ppp 相關介面。

都把 ppd 結束掉後重新測試。

==
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP