Ik ben al bijna de hele dag bezig om port forwarding met iptables aan de praat te krijgen, maar het lukt me op de één of andere manier gewoon niet. Even een overzichtje van de opbouw van m'n netwerk:
Nu is het dus de bedoeling dat verkeer wat binnenkomt op poort 3389 op m'n Linux server door gegeven wordt aan 192.168.0.2 op dezelfde poort. Om maar even volledig te zijn voeg ik de volledige output van iptables -L -v en iptables -t nat -L -v er maar even bij.
(excuses voor 't verneuken van de layout
)
Het probleem is nu echter dat er niemand een verbinding kan maken op die poort. Ik heb natuurlijk gecontroleerd of die poort op 192.168.0.2 wel open staat en dat staat ie. Het ging met ipchains vrij eenvoudig, maar met iptables kom ik er niet meer uit. Iemand die me hier mee kan helpen?
code:
1
2
3
4
5
6
7
8
9
10
| +-------------+
+-----| 192.168.0.2 |
| +-------------+
| +-------------+
+-----| 192.168.0.4 |
+-------+ +-------------+ | +-------------+
| Kabel | | Linux | |
| |---| 192.168.0.1 |------+
| Modem | | Server |
+-------+ +-------------+ |
Nu is het dus de bedoeling dat verkeer wat binnenkomt op poort 3389 op m'n Linux server door gegeven wordt aan 192.168.0.2 op dezelfde poort. Om maar even volledig te zijn voeg ik de volledige output van iptables -L -v en iptables -t nat -L -v er maar even bij.
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
| root@Linux:/home/jmezach/updee-2.0# iptables -L -v
Chain INPUT (policy DROP 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- lo any anywhere anywhere
118 8339 ACCEPT all -- eth0 any 192.168.0.0/24 anywhere
0 0 drop-and-log-it all -- eth1 any 192.168.0.0/24 anywhere
42 4316 ACCEPT all -- eth1 any anywhere cc7304-b.deven1.ov.home.nlstate RELATED,ESTABLISHED
0 0 ACCEPT tcp -- eth0 any anywhere anywhere tcp spt:bootpc dpt:bootps
0 0 ACCEPT udp -- eth0 any anywhere anywhere udp spt:bootpc dpt:bootps
0 0 ACCEPT tcp -- eth1 any anywhere cc7304-b.deven1.ov.home.nlstate NEW,RELATED,ESTABLISHED tcp dpt:http
0 0 ACCEPT tcp -- eth1 any anywhere cc7304-b.deven1.ov.home.nlstate NEW,RELATED,ESTABLISHED tcp dpt:ftp
0 0 ACCEPT tcp -- eth1 any anywhere cc7304-b.deven1.ov.home.nlstate NEW,RELATED,ESTABLISHED tcp dpt:7777
346 30334 drop-and-log-it all -- any any anywhere anywhere
Chain FORWARD (policy DROP 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
6241 5819K ACCEPT all -- eth1 eth0 anywhere anywhere state RELATED,ESTABLISHED
5053 545K ACCEPT all -- eth0 eth1 anywhere anywhere
0 0 ACCEPT tcp -- eth1 any anywhere anywhere tcp dpt:3389
0 0 drop-and-log-it all -- any any anywhere anywhere
Chain OUTPUT (policy DROP 7 packets, 2616 bytes)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- any lo anywhere anywhere
111 13777 ACCEPT all -- any eth0 192.168.0.0/24 192.168.0.0/24
0 0 drop-and-log-it all -- any eth1 anywhere 192.168.0.0/24
44 4567 ACCEPT all -- any eth1 cc7304-b.deven1.ov.home.nl anywhere
0 0 ACCEPT tcp -- any eth0 192.168.0.0/24 255.255.255.255 tcp spt:bootps dpt:bootpc
0 0 ACCEPT udp -- any eth0 192.168.0.0/24 255.255.255.255 udp spt:bootps dpt:bootpc
0 0 drop-and-log-it all -- any any anywhere anywhere
Chain drop-and-log-it (5 references)
pkts bytes target prot opt in out source destination
346 30334 LOG all -- any any anywhere anywhere LOG level info
346 30334 DROP all -- any any anywhere anywhere
root@Linux:/home/jmezach/updee-2.0# iptables -t nat -L -v
Chain PREROUTING (policy ACCEPT 376K packets, 28M bytes)
pkts bytes target prot opt in out source destination
0 0 DNAT tcp -- any any anywhere cc7304-b.deven1.ov.home.nltcp dpt:3389 to:192.168.0.2:3389
Chain POSTROUTING (policy ACCEPT 41 packets, 4859 bytes)
pkts bytes target prot opt in out source destination
408 19854 SNAT all -- any eth1 anywhere anywhere to:217.120.225.158
0 0 ACCEPT tcp -- any any anywhere cc7304-b.deven1.ov.home.nltcp dpt:3389
Chain OUTPUT (policy ACCEPT 1012 packets, 79935 bytes)
pkts bytes target prot opt in out source destination
root@Linux:/home/jmezach/updee-2.0# |
(excuses voor 't verneuken van de layout
Het probleem is nu echter dat er niemand een verbinding kan maken op die poort. Ik heb natuurlijk gecontroleerd of die poort op 192.168.0.2 wel open staat en dat staat ie. Het ging met ipchains vrij eenvoudig, maar met iptables kom ik er niet meer uit. Iemand die me hier mee kan helpen?