
私はiptables.conf
ほぼ次のようになります。
-A INPUT -p tcp --dport 65000 -j ACCEPT
-A INPUT -j DROP
私のsshd_config
外観は次のとおりです。
Port 22
Port 65000
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
私の目標は、ポート65000万の外の世界に開き、ポート22はLANに開くことです。
私は以下を使ってこの設定をテストしました。canyouseeme.orgポートに65000
次のルールを追加しないと、コンピュータにまったく接続できません。
-A INPUT -p tcp --dport 22 -j ACCEPT
その後、ポート 65000 に接続できます。
どうしたの?ポート65000に接続するためにポート22を開く必要があるのはなぜですか?
要求に応じて、全体の構成は次のとおりです。
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 DROP all -- * * 5.10.83.0/25 0.0.0.0/0
1040 146K ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:25
1 60 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:110
11 640 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80
1 40 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:443
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpts:60000:60020
0 0 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpts:60000:60020
3 180 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:65000
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:65001
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:65011
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:8888 state NEW,ESTABLISHED
0 0 ACCEPT all -- * * 127.0.0.1 0.0.0.0/0
735 67148 ACCEPT all -- * * 192.168.0.0/24 0.0.0.0/0
0 0 ACCEPT all -- * * 192.168.1.0/24 0.0.0.0/0
0 0 ACCEPT all -- * * 46.238.126.0/23 0.0.0.0/0
0 0 ACCEPT all -- * * 78.10.202.145 0.0.0.0/0
0 0 ACCEPT all -- * * 109.173.223.100 0.0.0.0/0
1274 166K DROP all -- * * 0.0.0.0/0 0.0.0.0/0
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
1409 219K ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:8888 state ESTABLISHED
ネットワークアドレス変換:
Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
答え1
私のルータは、いくつかの高いポートを内部SSHポートに転送するように設定されていたので、デフォルトでは問題は古代の設定の二日酔いによって引き起こされました。
どのくらい愚かなのか。