Portál AbcLinuxu, 18. prosince 2025 16:49
# Enable IP forwarding since it is disabled by default since echo "1" > /proc/sys/net/ipv4/ip_forward
# netstat -r
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.1.0 * 255.255.255.0 U 40 0 0 br0
224.0.0.0 * 240.0.0.0 U 40 0 0 eth0
default 192.168.1.1 0.0.0.0 UG 40 0 0 br0
# ifconfig br0
br0 Link encap:Ethernet HWaddr 00:E0:98:C5:DF:38
inet addr:192.168.1.3 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1
RX packets:333690 errors:0 dropped:0 overruns:0 frame:0
TX packets:2146 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:98332851 (93.7 MiB) TX bytes:350337 (342.1 KiB)
# ifconfig
eth0 Link encap:Ethernet HWaddr 00:XX:XX:XX:11:XX
inet addr:192.168.0.253 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:6431 errors:0 dropped:0 overruns:0 frame:0
TX packets:1715 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:592694 (578.8 KiB) TX bytes:386284 (377.2 KiB)
Interrupt:4
eth0:1 Link encap:Ethernet HWaddr 00:XX:XX:XX:11:XX
inet addr:192.168.100.252 Bcast:192.168.100.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:4
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
wlan0 Link encap:Ethernet HWaddr 00:XX:XX:XX:11:XX
inet addr:192.168.111.253 Bcast:192.168.111.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:1102 (1.0 KiB) TX bytes:0 (0.0 B)
Interrupt:2 Memory:bd400000-0
route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.100.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
192.168.111.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0
/etc/init.d/net.sh
#!/bin/sh
#Nastavenie ako AccessPoint; funkcne v1.3 ;vidiet klientov na wlan0
#version KUPE>>>>>>>>> v1.3
#zrusime bridge
ifconfig br0 down
brctl delbr br0
#nastavime interfaces a routes
ETH0=192.168.0.253
ETH0MASK=255.255.255.0
WLAN0=192.168.111.253
WLAN0MASK=255.255.255.0
DEFGW=192.168.0.1
ifconfig eth0 $ETH0 netmask $ETH0MASK
ifconfig eth0:1 192.168.100.252
ifconfig wlan0 $WLAN0 netmask $WLAN0MASK
route add default gw $DEFGW
#zacneme routovat
echo 1 > /proc/sys/net/ipv4/ip_forward
#firewall
iptables -F INPUT #flasnutie
iptables -A INPUT -s 192.168.0.XXX -j ACCEPT #povolenie z 2 mojich IP
iptables -A INPUT -s 192.168.100.XXX -j ACCEPT
iptables -A INPUT -p tcp --dport 23 -j REJECT
iptables -A INPUT -p tcp --dport 80 -j REJECT
iptables -t nat -F
iptables -t nat -I POSTROUTING -s 192.168.0.0/24 -d ! 192.168.0.0/24 -j SNAT --to 192.168.0.253
#este je jedna moznost pre NAT, ale to az potom,ak to nepojde
#zapneme dhcp
dhcpd wlan0
Co mas pod v bridge ???
¨brctl show¨
Dufam, ze pomoze
Peter
# brctl show
bridge name bridge id STP enabled interfaces
br0 0000.00e098c5df38 no eth0
wlan0
~ # brctl show bridge name bridge id STP enabled interfaces ~ #a mne to funguje bez problemov V tom,co som uviedol skor, je NAT a funguje OK. Mne to bezi a nestazujem si /aspon zatial
/.
Aky mas FW?
Skusil by som to upravit a potom uvidis - je tam zrusenie BRIDGE-u a spustenie NAT...
/pokazit by sa nemalo nic - ak sa nieco v skripte POKASLE, tak sa to spravi RESETOM pomocou tlacidla-to uz mam vyskusane. Iba daj pozor,aby si mal nastavene IP podla seba(aby ta pustil firewall na AP)/
KUPE
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.