Na een hele hoop vakantietijd er in te hebben gestopt leg ik het probleem ook maar eens voor aan jullie: het forwarden door onze linux router gaat niet goed. Internetten via deze machine gaat prima, maar ik wil graag apache op mijn apache op mijn eigen machine opstellen. Poort 80 wordt al door mijn huisgenoot op de router zelf gebruikt en dus gebruik ik zelf poort 8080. Echter om of andere reden werkt het niet zoals het zou moeten. We hebben al een andere nieuwere kernel geprobeert, alle eerdere forward regels die het ook niet deden verwijderd zodat we ons eerst kunnen focussen. Verder heb ik verschillende rc.firewall scripts vergeleken met die van ons, echter kan ik niet vinden wat er verschillend is.
Alles op een rijtje:
Linux kernel: 2.6.3
eth0 is de interne netwerkkaart
eth1 is extern
10.4.3.11 is mijn eigen machine
10.4.0.0/24 is ons subnet
internetten met nat gaat goed
forwarden naar de machine zelf ook (ssh), maar forwarden naar een andere machine niet
Het rc.firewall script:
output van /usr/sbin/iptables -L
Als je meer informatie nodig hebt hoor ik het graag
Alles op een rijtje:
Linux kernel: 2.6.3
eth0 is de interne netwerkkaart
eth1 is extern
10.4.3.11 is mijn eigen machine
10.4.0.0/24 is ons subnet
internetten met nat gaat goed
forwarden naar de machine zelf ook (ssh), maar forwarden naar een andere machine niet
Het rc.firewall script:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
| #!/bin/sh /bin/echo 1 > /proc/sys/net/ipv4/ip_forward /bin/echo 1 > /proc/sys/net/ipv4/tcp_syncookies /usr/sbin/iptables -F /usr/sbin/iptables -X /usr/sbin/iptables -t nat -F /usr/sbin/iptables -t nat -X #/usr/sbin/iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE #/usr/sbin/iptables -A FORWARD -i eth0 -s 10.4.1.1/16 -j ACCEPT #/usr/sbin/iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT #/usr/sbin/iptables -A FORWARD -i eth1 -o eth0 -p tcp --dport 8080 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT #/usr/sbin/iptables -A PREROUTING -t nat -p tcp --dport 8080 -j DNAT --to 10.4.3.11:80 /usr/sbin/iptables -P INPUT DROP /usr/sbin/iptables -P OUTPUT DROP /usr/sbin/iptables -P FORWARD DROP /usr/sbin/iptables -N icmp_packets /usr/sbin/iptables -N tcp_packets /usr/sbin/iptables -N udpincoming_packets /usr/sbin/iptables -N allowed /usr/sbin/iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE /usr/sbin/iptables -A FORWARD -i eth0 -s 10.4.1.1/16 -j ACCEPT /usr/sbin/iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT /usr/sbin/iptables -A FORWARD -i eth1 -o eth0 -p tcp --dport 8080 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT #/usr/sbin/iptables -A PREROUTING -t nat -p tcp --dport 8080 -j DNAT --to 10.4.3.11:80 /usr/sbin/iptables -t nat -A PREROUTING -p tcp -i eth1 --dport 8080 -j DNAT --to 10.4.3.11:80 /usr/sbin/iptables -A allowed -p TCP --syn -j ACCEPT /usr/sbin/iptables -A allowed -p TCP -m state --state ESTABLISHED,RELATED -j ACCEPT /usr/sbin/iptables -A allowed -p TCP -j DROP /usr/sbin/iptables -I INPUT -s 10.5.1.9 -j DROP /usr/sbin/iptables -A icmp_packets -p ICMP --icmp-type 0 -j ACCEPT /usr/sbin/iptables -A icmp_packets -p ICMP --icmp-type 3 -j ACCEPT /usr/sbin/iptables -A icmp_packets -p ICMP --icmp-type 5 -j ACCEPT /usr/sbin/iptables -A icmp_packets -p ICMP --icmp-type 8 -j ACCEPT /usr/sbin/iptables -A icmp_packets -p ICMP --icmp-type 11 -j ACCEPT /usr/sbin/iptables -A tcp_packets -p TCP --dport 113 -j allowed /usr/sbin/iptables -A tcp_packets -p TCP --dport 22 -j allowed /usr/sbin/iptables -A tcp_packets -p TCP -i eth0 --dport 21 -j allowed /usr/sbin/iptables -A tcp_packets -p TCP -i eth0 --dport 22 -j allowed /usr/sbin/iptables -A tcp_packets -p TCP -i eth0 --dport 19150 -j allowed /usr/sbin/iptables -A tcp_packets -p TCP -i eth0 --dport 137:139 -j allowed /usr/sbin/iptables -A tcp_packets -p TCP -i eth0 --sport 137:139 -j allowed /usr/sbin/iptables -A tcp_packets -p TCP -i eth0 --dport 80 -j allowed /usr/sbin/iptables -A tcp_packets -p TCP -i eth0 --dport 443 -j allowed /usr/sbin/iptables -A tcp_packets -p TCP -i eth0 --dport 4080 -j allowed #/usr/sbin/iptables -A tcp_packets -p TCP -i eth1 --dport 8080 -j allowed /usr/sbin/iptables -A tcp_packets -p TCP -i eth1 --dport 4662 -j allowed /usr/sbin/iptables -A udpincoming_packets -p UDP --dport 21 -j ACCEPT /usr/sbin/iptables -A udpincoming_packets -p UDP --sport 21 -j ACCEPT /usr/sbin/iptables -A udpincoming_packets -p UDP -i eth0 --dport 53 -j ACCEPT /usr/sbin/iptables -A udpincoming_packets -p UDP -i eth0 --dport 137:139 -j ACCEPT /usr/sbin/iptables -A udpincoming_packets -p UDP -i eth0 --sport 137:139 -j ACCEPT /usr/sbin/iptables -A udpincoming_packets -p UDP -i eth1 --dport 4662 -j ACCEPT /usr/sbin/iptables -A INPUT -p ICMP -j icmp_packets /usr/sbin/iptables -A INPUT -p TCP -j tcp_packets /usr/sbin/iptables -A INPUT -p UDP -j udpincoming_packets /usr/sbin/iptables -A INPUT -p ALL -d 127.0.0.1/32 -j ACCEPT /usr/sbin/iptables -A INPUT -p ALL -m state --state ESTABLISHED,RELATED -j ACCEPT /usr/sbin/iptables -A OUTPUT -p ALL -j ACCEPT |
output van /usr/sbin/iptables -L
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
| Chain INPUT (policy DROP) target prot opt source destination DROP all -- 10.5.1.9 anywhere icmp_packets icmp -- anywhere anywhere tcp_packets tcp -- anywhere anywhere udpincoming_packets udp -- anywhere anywhere ACCEPT all -- anywhere localhost ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED Chain FORWARD (policy DROP) target prot opt source destination ACCEPT all -- 10.4.0.0/16 anywhere ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED ACCEPT tcp -- anywhere anywhere tcp dpt:8080 state NEW,RELATED,ESTABLISHED Chain OUTPUT (policy DROP) target prot opt source destination ACCEPT all -- anywhere anywhere Chain allowed (12 references) target prot opt source destination ACCEPT tcp -- anywhere anywhere tcp flags:SYN,RST,ACK/SYN ACCEPT tcp -- anywhere anywhere state RELATED,ESTABLISHED DROP tcp -- anywhere anywhere Chain icmp_packets (1 references) target prot opt source destination ACCEPT icmp -- anywhere anywhere icmp echo-reply ACCEPT icmp -- anywhere anywhere icmp destination-unreachable ACCEPT icmp -- anywhere anywhere icmp redirect ACCEPT icmp -- anywhere anywhere icmp echo-request ACCEPT icmp -- anywhere anywhere icmp time-exceeded Chain tcp_packets (1 references) target prot opt source destination allowed tcp -- anywhere anywhere tcp dpt:auth allowed tcp -- anywhere anywhere tcp dpt:ssh allowed tcp -- anywhere anywhere tcp dpt:ftp allowed tcp -- anywhere anywhere tcp dpt:ssh allowed tcp -- anywhere anywhere tcp dpt:19150 allowed tcp -- anywhere anywhere tcp dpts:netbios-ns:netbios-ssn allowed tcp -- anywhere anywhere tcp spts:netbios-ns:netbios-ssn allowed tcp -- anywhere anywhere tcp dpt:http allowed tcp -- anywhere anywhere tcp dpt:https allowed tcp -- anywhere anywhere tcp dpt:4080 allowed tcp -- anywhere anywhere tcp dpt:8080 allowed tcp -- anywhere anywhere tcp dpt:4662 Chain udpincoming_packets (1 references) target prot opt source destination ACCEPT udp -- anywhere anywhere udp dpt:ftp ACCEPT udp -- anywhere anywhere udp spt:ftp ACCEPT udp -- anywhere anywhere udp dpt:domain ACCEPT udp -- anywhere anywhere udp dpts:netbios-ns:netbios-ssn ACCEPT udp -- anywhere anywhere udp spts:netbios-ns:netbios-ssn ACCEPT udp -- anywhere anywhere udp dpt:4662 |
Als je meer informatie nodig hebt hoor ik het graag