Chinaunix

标题: 请求帮助:PPPOE的动态外网IP。想用DNAT把内网的主机给映射出去。怎么做?跪求~! [打印本页]

作者: mjsline    时间: 2012-02-10 21:40
标题: 请求帮助:PPPOE的动态外网IP。想用DNAT把内网的主机给映射出去。怎么做?跪求~!
PPPOE的动态IP。如何做DNAT。求iptables语句。例如我要将内网的192.168.1.2的80映射出来(外网访问本路由器跳转到192.168.1.2:80)
我的接口信息如下 :
  1. eth1    Link encap:Ethernet  HWaddr 00:1F:A3:65:3E:A3
  2.           inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
  3.           inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
  4.           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  5.           RX packets:2020 errors:0 dropped:0 overruns:0 frame:0
  6.           TX packets:1427 errors:0 dropped:0 overruns:0 carrier:0
  7.           collisions:0 txqueuelen:0
  8.           RX bytes:132467 (129.3 KiB)  TX bytes:197778 (193.1 KiB)

  9. eth0      Link encap:Ethernet  HWaddr 00:1F:A3:65:3E:A3
  10.           inet6 addr: fe80::21f:a3ff:fe65:3ea3/64 Scope:Link
  11.           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  12.           RX packets:3075 errors:0 dropped:0 overruns:0 frame:0
  13.           TX packets:3036 errors:0 dropped:0 overruns:0 carrier:0
  14.           collisions:0 txqueuelen:1000
  15.           RX bytes:521449 (509.2 KiB)  TX bytes:1990259 (1.8 MiB)
  16.           Interrupt:25 Base address:0x5120

  17. lo        Link encap:Local Loopback
  18.           inet addr:127.0.0.1  Mask:255.0.0.0
  19.           inet6 addr: ::1/128 Scope:Host
  20.           UP LOOPBACK RUNNING  MTU:16436  Metric:1
  21.           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
  22.           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
  23.           collisions:0 txqueuelen:0
  24.           RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

  25. pppoe-wan Link encap:Point-to-Point Protocol
  26.           inet addr:180.125.32.22  P-t-P:180.125.32.1  Mask:255.255.255.255
  27.           UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1492  Metric:1
  28.           RX packets:1272 errors:0 dropped:0 overruns:0 frame:0
  29.           TX packets:1459 errors:0 dropped:0 overruns:0 carrier:0
  30.           collisions:0 txqueuelen:3
  31.           RX bytes:167226 (163.3 KiB)  TX bytes:73153 (71.4 KiB)
复制代码

作者: kwest    时间: 2012-02-11 17:39
iptables -t nat -A PREROUTING -i pppoe_wan -p tcp --dport 80 -j DNAT --to-destination 192.168.1.2:80




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2