tôi muốn cho phép tất cả lưu lượng truy cập vào ip cụ thể, sử dụng iptables.
đã thử bằng cách thêm dòng:
/sbin/iptables -A INPUT -p tcp -s XXX.XXX.XXX.XXX -j ACCEPT
/sbin/iptables -A OUTPUT -p tcp -s XXX.XXX.XXX.XXX -j ACCEPT
... nhưng vẫn không thể truy cập vào ip từ xa (XXX.XXX.XXX.XXX).
Lời khuyên nào?
tnx trong adv!
EDIT: với lời khuyên của bạn, tôi đã thay đổi iptables. tôi vẫn không thể kết nối với máy chủ từ xa. trạng thái iptables trông như thế này:
[root@myserver ~]# /etc/init.d/iptables status
Table: nat
Chain PREROUTING (policy ACCEPT)
num target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
num target prot opt source destination
Chain OUTPUT (policy ACCEPT)
num target prot opt source destination
Table: mangle
Chain PREROUTING (policy ACCEPT)
num target prot opt source destination
Chain INPUT (policy ACCEPT)
num target prot opt source destination
Chain FORWARD (policy ACCEPT)
num target prot opt source destination
Chain OUTPUT (policy ACCEPT)
num target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
num target prot opt source destination
Table: filter
Chain INPUT (policy DROP)
num target prot opt source destination
1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
2 REJECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp flags:!0x17/0x02 reject-with tcp-reset
3 DROP all -- 0.0.0.0/0 0.0.0.0/0 state INVALID
4 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
5 DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpts:1024:65535
6 DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:8443
7 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:3718
8 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:88
9 ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:88
10 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:8080
11 ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:8080
12 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:873
13 ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:873
14 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:8880
15 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80
16 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:443
17 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:21
18 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:20
19 ACCEPT tcp -- XXX.XXX.XXX.XXX 0.0.0.0/0
20 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:22
21 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:587
22 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:25
23 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:465
24 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:110
25 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:995
26 DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:143
27 DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:993
28 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:106
29 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:3306
30 DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:5432
31 DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:9008
32 DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:9080
33 DROP udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:137
34 DROP udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:138
35 DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:139
36 DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:445
37 ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:1194
38 ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:53
39 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:53
40 ACCEPT icmp -- 207.250.234.40 0.0.0.0/0 icmp type 8 code 0
41 DROP icmp -- 0.0.0.0/0 0.0.0.0/0 icmp type 8 code 0
42 DROP all -- 0.0.0.0/0 0.0.0.0/0
Chain FORWARD (policy DROP)
num target prot opt source destination
1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
2 REJECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp flags:!0x17/0x02 reject-with tcp-reset
3 DROP all -- 0.0.0.0/0 0.0.0.0/0 state INVALID
4 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
5 DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:8443
6 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:3718
7 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:88
8 ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:88
9 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:8080
10 ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:8080
11 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:873
12 ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:873
13 DROP all -- 0.0.0.0/0 0.0.0.0/0
Chain OUTPUT (policy DROP)
num target prot opt source destination
1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
2 REJECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp flags:!0x17/0x02 reject-with tcp-reset
3 DROP all -- 0.0.0.0/0 0.0.0.0/0 state INVALID
4 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
5 DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpts:1024:65535
6 DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:8443
7 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:3718
8 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:21
9 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:20
10 ACCEPT tcp -- 0.0.0.0/0 XXX.XXX.XXX.XXX
11 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:88
12 ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:88
13 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:8080
14 ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:8080
15 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:873
16 ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:873
17 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
[root@myserver ~]#