Finally, I understood the principles of using pppoe + NAT as an Internet server.
RP-pppoe settings :
CheckRppppoeInstalled (RedflagInstalled)
Rpm - QA | Grep - I " Pppoe "
/Etc/PPP/PAP-secretsThe configuration is as follows::
# Client Server secret IP Address
" USR " * " 123 " *
/etc/PPP/chap-secrets Configuration and Pap-secrets same
/Etc/PPP/Pppoe-Server-OptionsThe configuration is as follows::
# Auth # comment out the three lines and use any account to log on
# Require-pap
# Require-Chap
Login
LCP - Echo - Interval 30
LCP - Echo - Failure 4
MS - DNS 202.118 . 224.101
Then run:
Modprobe pppoe
Pppoe - Server - I eth1 - N 200 - L 192.168 . 0.1 - R 192.168 . 0.100 - R - U
Iptables settings:
OpenIPForwarding and Nat Functions
Echo 1 > / Proc / Sys / Net / IPv4 / Ip_forward
Iptables - T Nat - F
Iptables - T Nat - L
Iptables - T Nat - A postrouting - O eth0 - J SNAT -- To 219.217 . 235.73
# Iptables-T Nat-A postrouting-O eth0-j snat-s 192.168.0.0/24 -- To 219.217.235.73
Pppoe-server-IEth1-R-u
UseXPThe connection is ready.
Note:
In order to prevent users in the LAN from setting the same IP address as eth1, so as to indirectly access the Internet, the IPaddress of eth1 must be set to null!
I guess
When you use NAT to access the Internet, after the customer sets the IP address and gateway to eth1, the connection sent to the server will be identified by iptables and routed in the past.
After pppoe is configured, if the customer does not establish a pppoe connection,
The datagram sent to the server is ignored, and iptables cannot recognize it.
After the connection is established,Iptables can recognize it.
The specific implementation is to be studied.