Re: [問題] Ubuntu server 18.04的iptables怪怪的
※ 引述《fordmvp (無名氏)》之銘言:
※ 引述《fordmvp (無名氏)》之銘言:
: 標題: [問題] Ubuntu server 18.04的iptables怪怪的
: 時間: Mon Dec 30 21:02:56 2019
:
: 本來有ufw但不符需求,無法鎖網卡和增加時間參數等。
:
: 後來我把ufw移除了,但iptables怪怪的,用script shell輸入後,查iptables -L,規則
有
: 輸入成功,但是實際執行起來都無效。
:
:
: 我的iptables是1.6.1版。
:
: --
: ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 111.82.248.7 (臺灣)
: ※ 文章網址: https://www.ptt.cc/bbs/Linux/M.1577710978.A.242.html
: → newversion: 所以你要問什麼? 12/30 23:
31
: 請問iptables為何會無效?要怎麼改善?
: ※ 編輯: fordmvp (163.19.173.88 臺灣), 12/31/2019 09:19:35
: 請問iptables在18.04還可以用嗎?
:
: 以前我用14.04還好好的。
:
: 不知道16.04情況如何?
: ※ 編輯: fordmvp (163.19.173.88 臺灣), 12/31/2019 17:16:27
: → ssdoz2sk: 你應該拿出你目前的iptables資訊(iptables -nvL --line) 01/01 20:
05
: → ssdoz2sk: 然後說你現在想要從外面或哪個內網 ip 連到這台的哪個 01/01 20:
06
: → ssdoz2sk: port 走啥協定ipv4 ipv6等等的,一些基本資料 01/01 20:
08
: → ssdoz2sk: 阿不然我這樣回答你 iptables 可以用啊 01/01 20:
10
: → ssdoz2sk: 16 18 19 我都在用...好了,你的問題我解決了? 01/01 20:
10
: → duckfly: iptables-persistent netfilter-persistent 01/01 22:
23
抱歉,我之前資訊不足
我主要是參考這篇
https://s2.dces.tn.edu.tw/download/Ubuntu1804asTransparentGate_1.1.pdf
我的通透式防火牆建好了
之前是nameserver 沒弄好,導致防火牆主機本身無法上網,也不能更新。
ssh只有同網域ip可登入,外部ip即使修改INPUT和OUTPUT規則
也沒用。但現在改好後,已解決。
但FORWARD的部分一直無效,即使設了規則,內網的電腦仍可上網
完全擋不住,通行無阻。
例如:我下了
iptables -A FORWARD -d xxx.xxx.xxx.23 -j DROP
iptables -A FORWARD -s xxx.xxx.xxx.23 -j DROP
至於iptables -nvL --line的部分,因為我是用script shell
寫規則。但是內容太多且很多涉及隱私。
實在不方便提供。
我的etc/rc.local
#!/bin/bash## rc.local## This script is executed at the end of each
multiuser runlevel.# Make sure that the script will "exit 0" on success or
any other# value on error.## In order to enable or disable this script
just change the execution# bits.## By default this script does
nothing./etc/init.d/route.sh
exit 0
後來我直接下 iptables -F
然後
iptables -P FORWARD DROP
再查iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy DROP)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
但是還是沒用
請大家提供意見。
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 59.126.170.22 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Linux/M.1578139741.A.B0F.html
※ 編輯: fordmvp (59.126.170.22 臺灣), 01/04/2020 20:09:44
※ 編輯: fordmvp (59.126.170.22 臺灣), 01/04/2020 20:31:14
→
01/04 22:09,
01/04 22:09
我也懷疑過,但我把這台主機關機過,內網的電腦就無法上網了。
而且我也檢查過線路。
不然明天我再去檢查一次。
※ 編輯: fordmvp (59.126.170.22 臺灣), 01/04/2020 22:12:54
推
01/05 19:30,
01/05 19:30
我查過線路,確定沒問題。
我也測過把規則全清乾淨,只預設drop和封某個ip都沒用!
實在不知道怎麼辦了!
請神人解救!
※ 編輯: fordmvp (111.253.104.87 臺灣), 01/06/2020 21:29:24
推
01/07 09:40,
01/07 09:40
請問怎麼看?
※ 編輯: fordmvp (223.141.132.69 臺灣), 01/07/2020 14:26:31
→
01/07 15:53,
01/07 15:53
不好意思隔了這麼久才回應。
用tracepath 查封包流向看起來也正常。
請問有人知道如何查看封包在iptables內部的流向嗎?會不會是這邊的問題?
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 59.126.170.22 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Linux/M.1578925682.A.D98.html
→
01/14 00:36,
4年前
, 1F
01/14 00:36, 1F
→
01/14 00:36,
4年前
, 2F
01/14 00:36, 2F
推
01/14 00:38,
4年前
, 3F
01/14 00:38, 3F
→
01/14 00:39,
4年前
, 4F
01/14 00:39, 4F
推
01/14 07:15,
4年前
, 5F
01/14 07:15, 5F
→
01/14 07:15,
4年前
, 6F
01/14 07:15, 6F
推
01/14 09:57,
4年前
, 7F
01/14 09:57, 7F
→
01/14 16:07,
4年前
, 8F
01/14 16:07, 8F
→
01/15 09:21,
4年前
, 9F
01/15 09:21, 9F
→
01/18 20:43,
4年前
, 10F
01/18 20:43, 10F
→
01/18 20:45,
4年前
, 11F
01/18 20:45, 11F
討論串 (同標題文章)
完整討論串 (本文為第 3 之 3 篇):