pinotje
Verified User
Hi all,
I've successfully (without any problems) followed all the steps at:
http://help.directadmin.com/item.php?id=380
Now, I don't want to use the standard SSH port (22),
so I tried to add a different port to iptables with:
/sbin/iptables -A INPUT -p tcp --dport 5356 -j ACCEPT
Then I save it:
/sbin/iptables-save
And then I check it if the port is correctly added:
/sbin/iptables -nL
output:
According to the output above, the port 5356 is correctly added to iptables.
But if I restart the iptables (/etc/init.d/iptables restart),
the added port is suddenly disappeared.
What is the problem?
Can someone just tell me how to open/add a port in iptables?
Thanks!
I've successfully (without any problems) followed all the steps at:
http://help.directadmin.com/item.php?id=380
Now, I don't want to use the standard SSH port (22),
so I tried to add a different port to iptables with:
/sbin/iptables -A INPUT -p tcp --dport 5356 -j ACCEPT
Then I save it:
/sbin/iptables-save
And then I check it if the port is correctly added:
/sbin/iptables -nL
output:
Code:
[root@server1 sysconfig]# /sbin/iptables -nL
Chain INPUT (policy ACCEPT)
target prot opt source destination
DROP all -- 0.0.0.0/0 0.0.0.0/0 state INVALID
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
REJECT all -- 0.0.0.0/0 127.0.0.0/8 reject-with icmp-port-unreachable
DROP all -- 24.214.232.229 0.0.0.0/0
DROP icmp -- 0.0.0.0/0 0.0.0.0/0
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:20
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:21
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:22
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:2222
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:25 flags:0x17/0x02 limit: avg 1/sec burst 10
DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:25 flags:0x17/0x02
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:25
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:587
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:53
ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:53
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:110
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:113
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:143
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:443
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:3306
ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:3306
LOG tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:1433 limit: avg 3/hour burst 5 LOG flags 0 level 4 prefix `Firewalled packet: MSSQL '
DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:1433
LOG tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:6670 limit: avg 3/hour burst 5 LOG flags 0 level 4 prefix `Firewalled packet: Deepthrt '
DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:6670
LOG tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:6711 limit: avg 3/hour burst 5 LOG flags 0 level 4 prefix `Firewalled packet: Sub7 '
DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:6711
LOG tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:6712 limit: avg 3/hour burst 5 LOG flags 0 level 4 prefix `Firewalled packet: Sub7 '
DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:6712
LOG tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:6713 limit: avg 3/hour burst 5 LOG flags 0 level 4 prefix `Firewalled packet: Sub7 '
DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:6713
LOG tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:12345 limit: avg 3/hour burst 5 LOG flags 0 level 4 prefix `Firewalled packet: Netbus '
DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:12345
LOG tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:12346 limit: avg 3/hour burst 5 LOG flags 0 level 4 prefix `Firewalled packet: Netbus '
DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:12346
LOG tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:20034 limit: avg 3/hour burst 5 LOG flags 0 level 4 prefix `Firewalled packet: Netbus '
DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:20034
LOG tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:31337 limit: avg 3/hour burst 5 LOG flags 0 level 4 prefix `Firewalled packet: BO '
DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:31337
LOG tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:6000 limit: avg 3/hour burst 5 LOG flags 0 level 4 prefix `Firewalled packet: XWin '
DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:6000
DROP udp -- 0.0.0.0/0 0.0.0.0/0 udp dpts:33434:33523
REJECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:113 reject-with icmp-port-unreachable
REJECT 2 -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-port-unreachable
REJECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 reject-with icmp-port-unreachable
REJECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:443 reject-with icmp-port-unreachable
LOG tcp -- 0.0.0.0/0 0.0.0.0/0 tcp flags:0x17/0x02 limit: avg 5/min burst 5 LOG flags 0 level 4 prefix `Firewalled packet:'
REJECT tcp -- 0.0.0.0/0 0.0.0.0/0 reject-with tcp-reset
DROP all -- 0.0.0.0/0 0.0.0.0/0
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:5356
Chain FORWARD (policy DROP)
target prot opt source destination
DROP all -- 0.0.0.0/0 0.0.0.0/0 state INVALID
LOG tcp -- 0.0.0.0/0 0.0.0.0/0 tcp flags:0x17/0x02 limit: avg 5/min burst 5 LOG flags 0 level 4 prefix `Firewalled packet:'
REJECT tcp -- 0.0.0.0/0 0.0.0.0/0 reject-with tcp-reset
DROP all -- 0.0.0.0/0 0.0.0.0/0
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpts:6660:6669
DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:7000
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
[root@server1 sysconfig]#
According to the output above, the port 5356 is correctly added to iptables.
But if I restart the iptables (/etc/init.d/iptables restart),
the added port is suddenly disappeared.
What is the problem?
Can someone just tell me how to open/add a port in iptables?
Thanks!