当前位置: 技术问答>linux和unix
CentOs通过ADSL拨号上网作为VPN服务器,客户端可以连接上,但是不能上internet网。
来源: 互联网 发布时间:2017-04-24
本文导语: CentOs通过ADSL拨号上网作为VPN服务器,客户端可以连接上,但是不能上internet网。服务器是可以上internet网的,要怎样做客户端才同样可以上得了internet网呢? [admin@localhost ~]$ ifconfig eth0 Link encap:Ethernet HWaddr...
CentOs通过ADSL拨号上网作为VPN服务器,客户端可以连接上,但是不能上internet网。服务器是可以上internet网的,要怎样做客户端才同样可以上得了internet网呢?
[admin@localhost ~]$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:E0:B1:1C:04:1D
inet6 addr: fe80::2e0:b1ff:fe1c:41d/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:30368 errors:0 dropped:0 overruns:0 frame:0
TX packets:32733 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:24196196 (23.0 MiB) TX bytes:4437156 (4.2 MiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:29 errors:0 dropped:0 overruns:0 frame:0
TX packets:29 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3978 (3.8 KiB) TX bytes:3978 (3.8 KiB)
ppp0 Link encap:Point-to-Point Protocol
inet addr:27.43.71.37 P-t-P:27.43.64.1 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492 Metric:1
RX packets:29842 errors:0 dropped:0 overruns:0 frame:0
TX packets:32203 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:23508052 (22.4 MiB) TX bytes:3712453 (3.5 MiB)
ppp1 Link encap:Point-to-Point Protocol
inet addr:192.168.0.100 P-t-P:192.168.0.101 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1396 Metric:1
RX packets:626 errors:4 dropped:0 overruns:0 frame:0
TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:38278 (37.3 KiB) TX bytes:94 (94.0 b)
ppp0是服务器,ppp1是客户端。
[admin@localhost ~]$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:E0:B1:1C:04:1D
inet6 addr: fe80::2e0:b1ff:fe1c:41d/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:30368 errors:0 dropped:0 overruns:0 frame:0
TX packets:32733 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:24196196 (23.0 MiB) TX bytes:4437156 (4.2 MiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:29 errors:0 dropped:0 overruns:0 frame:0
TX packets:29 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3978 (3.8 KiB) TX bytes:3978 (3.8 KiB)
ppp0 Link encap:Point-to-Point Protocol
inet addr:27.43.71.37 P-t-P:27.43.64.1 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492 Metric:1
RX packets:29842 errors:0 dropped:0 overruns:0 frame:0
TX packets:32203 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:23508052 (22.4 MiB) TX bytes:3712453 (3.5 MiB)
ppp1 Link encap:Point-to-Point Protocol
inet addr:192.168.0.100 P-t-P:192.168.0.101 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1396 Metric:1
RX packets:626 errors:4 dropped:0 overruns:0 frame:0
TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:38278 (37.3 KiB) TX bytes:94 (94.0 b)
ppp0是服务器,ppp1是客户端。
|
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o ppp0 -j MASQUERADE