Witam!
Mój główny router (WND3700) ma dostęp do Internetu za pomocą modemu ADSL Netgear DG834 skonfigurowanego jako mostek (nie jestem pewny czy tak to się fachowo nazywa, w każdym razie modem jest "przeźroczysty", nie ma na nim NAT, DHCP, router inicjuje połączenie, etc.) i żeby się do niego dostać musiałem sobie skonfigurować odpowiednio firewall na routerze.
Tak wygląda /etc/firewall.user
# This file is interpreted as shell script.
# Put your custom iptables rules here, they will
# be executed with each firewall (re-)start.
# Internal uci firewall chains are flushed and recreated on reload, so
# put custom rules into the root chains e.g. INPUT or FORWARD or into the
# special user chains, e.g. input_wan_rule or postrouting_lan_rule.
ifconfig eth1 192.168.0.2
# Panel administracyjny DG834
iptables -t nat -I postrouting_rule -p tcp --src 192.168.1.0/24 --dst 192.168.0.1 --dport 80 -j SNAT --to 192.168.0.2
iptables -I zone_lan_forward -p tcp --src 192.168.1.0/24 --dst 192.168.0.1 --dport 80 -j ACCEPT
# Ping
iptables -t nat -I postrouting_rule -p icmp --src 192.168.1.0/24 --dst 192.168.0.1 -j SNAT --to 192.168.0.2
iptables -I zone_lan_forward -p icmp --src 192.168.1.0/24 --dst 192.168.0.1 -j ACCEPT
# Telnet
iptables -t nat -I postrouting_rule -p tcp --src 192.168.1.0/24 --dst 192.168.0.1 --dport 23 -j SNAT --to 192.168.0.2
iptables -I zone_lan_forward -p tcp --src 192.168.1.0/24 --dst 192.168.0.1 --dport 23 -j ACCEPT
A coś takiego mam gdy wpiszę uci show firewall
firewall.@defaults[0]=defaults
firewall.@defaults[0].syn_flood=1
firewall.@defaults[0].input=ACCEPT
firewall.@defaults[0].output=ACCEPT
firewall.@defaults[0].forward=REJECT
firewall.@zone[0]=zone
firewall.@zone[0].name=lan
firewall.@zone[0].network=lan
firewall.@zone[0].input=ACCEPT
firewall.@zone[0].output=ACCEPT
firewall.@zone[0].forward=REJECT
firewall.@zone[1]=zone
firewall.@zone[1].name=wan
firewall.@zone[1].network=wan wan6
firewall.@zone[1].input=REJECT
firewall.@zone[1].output=ACCEPT
firewall.@zone[1].forward=REJECT
firewall.@zone[1].masq=1
firewall.@zone[1].mtu_fix=1
firewall.@forwarding[0]=forwarding
firewall.@forwarding[0].src=lan
firewall.@forwarding[0].dest=wan
firewall.@rule[0]=rule
firewall.@rule[0].name=Allow-DHCP-Renew
firewall.@rule[0].src=wan
firewall.@rule[0].proto=udp
firewall.@rule[0].dest_port=68
firewall.@rule[0].target=ACCEPT
firewall.@rule[0].family=ipv4
firewall.@rule[1]=rule
firewall.@rule[1].name=Allow-Ping
firewall.@rule[1].src=wan
firewall.@rule[1].proto=icmp
firewall.@rule[1].icmp_type=echo-request
firewall.@rule[1].family=ipv4
firewall.@rule[1].target=ACCEPT
firewall.@rule[2]=rule
firewall.@rule[2].name=Allow-DHCPv6
firewall.@rule[2].src=wan
firewall.@rule[2].proto=udp
firewall.@rule[2].src_ip=fe80::/10
firewall.@rule[2].src_port=547
firewall.@rule[2].dest_ip=fe80::/10
firewall.@rule[2].dest_port=546
firewall.@rule[2].family=ipv6
firewall.@rule[2].target=ACCEPT
firewall.@rule[3]=rule
firewall.@rule[3].name=Allow-ICMPv6-Input
firewall.@rule[3].src=wan
firewall.@rule[3].proto=icmp
firewall.@rule[3].icmp_type=echo-request echo-reply destination-unreachable packet-too-big time-exceeded bad-header unknown-header-type router-solicitation neighbour-solicitation router-advertisement neighbour-advertisement
firewall.@rule[3].limit=1000/sec
firewall.@rule[3].family=ipv6
firewall.@rule[3].target=ACCEPT
firewall.@rule[4]=rule
firewall.@rule[4].name=Allow-ICMPv6-Forward
firewall.@rule[4].src=wan
firewall.@rule[4].dest=*
firewall.@rule[4].proto=icmp
firewall.@rule[4].icmp_type=echo-request echo-reply destination-unreachable packet-too-big time-exceeded bad-header unknown-header-type
firewall.@rule[4].limit=1000/sec
firewall.@rule[4].family=ipv6
firewall.@rule[4].target=ACCEPT
firewall.@include[0]=include
firewall.@include[0].path=/etc/firewall.user
firewall.@redirect[0]=redirect
firewall.@redirect[0]._name=serwer1
# i tu jest jeszcze kilka
# innych przekierowań
# portów
Kiedyś to działało bez problemu i mogłem się połączyć z modemem zarówno przez programy diagnostyczne typu DMT (telnet) jak i zwykły panel administracyjny po http. Jednak nie miałem potrzeby używać tego przez dłuższy czas, ale ostatnio chciałem sprawdzić parametry mojego linii, bo były w okolicy wykonywane pewne prace naprawcze i za nic nie jestem w stanie tego zrobić. Pingi na 192.168.0.1 nie dochodzą, nie jestem w stanie uzyskać połączenia przez telent i www.
Czy coś się zmieniło w sposobie działania firewalla w OpenWrt w ciągu ostatnich kilku miesięcy? Bo używałem tej konfiguracji od prawie 3 lat i wszystko było OK.
Moja obecna wersja OpenWrt to:
----------------------------------------------------------------
| |
| OpenWrt Attitude Adjustment 12.09.1 (r37559) |
| Build time: 2013-07-27 07:36 CEST |
| |
| Cezary Jackiewicz (obsy), http://eko.one.pl |
| |
----------------------------------------------------------------
| Machine: NETGEAR WNDR3700v2 |
| Uptime: 2d, 11:10:12 |
| Load: 0.00 0.01 0.05 |
| Flash: total: 12.4M, free: 11.6M, used: 6% |
| Memory: total: 61688K, free: 47560K, used: 22% |
| WAN: xxx.xx.xx.xxx, proto: pppoe |
| LAN: 192.168.1.1 |
| WLAN: mode: ap, ssid: SkynetNG, channel: 8, conn: 2 |
| WLAN: mode: ap, ssid: SkynetN5G, channel: 36, conn: 0 |
----------------------------------------------------------------
Będę wdzięczny za wszelką pomoc
Edit:
Konfiguracja na podstawie http://openrouter.info/index.php?option … ;Itemid=61 z punktu "Wykorzystanie SNAT w OpenWrt jako dostęp do modemu ADSL." (mniej więcej w połowie strony)