10. 最後iptable rule 中再加上
 

# nmcli connection edit type pppoe con-name "ppp0"
: ===| nmcli 互動式連線編纂程式 |===
: 新增一項「pppoe」連線
: 輸入「help」或是「?」以獲得可用指令。
: 鍵入“print”以顯示所有連接屬性。
: 輸入「describe [<setting>.<prop>]」以獲得具體的內容描寫。
: 您可編輯以下設定:connection, pppoe, 802-3-ethernet (ethernet), ppp, 802-1x,
: ethtool, match, ipv4, ipv6, tc, proxy
nmcli> set connection.autoconnect yes
nmcli> set connection.interface-name ppp0
nmcli> set pppoe.parent enp1s0f0
nmcli> set pppoe.username (您的帳號名稱)
nmcli> set pppoe.password (您的連線暗碼)
nmcli> save persistent
: 雖然說可以成功撥接連線,但照舊開機後有時辰撥接會出狀態,還要重開一次
# nmcli connection up ppp0


9. 消滅規則並建樹NAT

  1. systemctl start iptables
  2. systemctl enable iptables
複製代碼
  1. systemctl stop firewalld
  2. systemctl disable firewalld
複製代碼
  1. systemctl mask firewalld
複製代碼
  1. iptables -L
  2. Chain INPUT (policy ACCEPT)
  3. target     prot opt source               destination         
  4. ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED
  5. ACCEPT     icmp --  anywhere             anywhere            
  6. ACCEPT     all  --  anywhere             anywhere            
  7. ACCEPT     tcp  --  anywhere             anywhere             state NEW tcp dpt:ssh
  8. REJECT     all  --  anywhere             anywhere             reject-with icmp-host-prohibited
  9.  
  10. Chain FORWARD (policy ACCEPT)
  11. target     prot opt source               destination         
  12. REJECT     all  --  anywhere             anywhere             reject-with icmp-host-prohibited
  13.  
  14. Chain OUTPUT (policy ACCEPT)
  15. target     prot opt source               destination         
網站架設 複製代碼


5. 遮罩firewalld

NETYEA 網頁設計

用nmcli可以成功設立建設pppoe連線
: (鄙人列例子中,我將pppoe連線命名為ppp0,刻意設定為需要時才手動進行撥接,
: 網卡的裝配名稱為對外enp1s0f0, 對內enp1s0f1)
1. 安裝模組網站架設 NetworkManager-ppp ppp
enp1s0f0設定IP:192.168.0.254
enp1s0f0設定IP:192.168.1.254

1.安裝模組

  1. dnf install NetworkManager-ppp -y
  2. dnf install ppp -y
複製代碼


4. 停止及封閉firewalld
 

  1. iptables -t mangle -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
網站架設 複製代碼


 



6. 安裝iptables
 


8. 搜檢 iptables規則
 

 


7. 最先跟啟動 iptables

  1. FW_IP="你的PPPOE IP
  2. EXTERNAL=PPP0
  3. #EXTERNAL=enp1s0f0
  4. INTERNAL=enp1s0f1
  5. iptables -F
  6. iptables -X
  7. iptables -Z
  8. iptables -t nat -F
  9. iptables -t nat -X
  10. iptables -t nat -Z
  11. iptables -t mangle -F
  12. iptables -t mangle -X
  13. iptables -t mangle -Z
  14.  
  15. iptables -P INPUT DROP
  16. iptables -P OUTPUT ACCEPT
  17. iptables -P FORWARD ACCEPT
  18. iptables -t nat -P PREROUTING ACCEPT
  19. iptables -t nat -P POSTROUTING ACCEPT
  20. iptables -t nat -P OUTPUT ACCEPT
  21.  
  22. echo "1" > /proc/sys/net/ipv4/ip_forward
  23. modprobe ip_nat_ftp
  24. modprobe ip_conntrack
  25. modprobe ip_conntrack_ftp
  26. modprobe ip_conntrack_irc
  27.  
  28. iptables -t nat -A POSTROUTING -o $EXTERNAL -s 192.168.1.0/24 -j SNAT --to $FW_IP
  29.  
  30. iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT
  31.  
  32. if [ -e /proc/sys/net/ipv4/tcp_syncookies ]; then
  33.        echo "1" > /proc/sys/net/ipv4/tcp_syncookies
  34. fi
複製代碼



具體請參考文章
http://www.tshopping.com.tw/thread-264352-1-1.html
http://www.tshopping.com.tw/thread-264354-1-1.html
http://www.tshopping.com.tw/thread-264355-1-1.html

2. 下載re-pppoe rpm
載點

3. 安裝rpm

  1. rpm -ivh rp-pppoe-3.14-7.el8.lux.x86_64.rpm
複製代碼
  1. yum install iptables-services
複製代碼
arrow
arrow
    文章標籤
    網站架設
    全站熱搜

    hallk6k22ej 發表在 痞客邦 留言(0) 人氣()