Naime, na kompu imam 2 ethernet kartice; jedna od njih (eth0) ima pristup internetu, a druga (eth1) ide na switch gdje se treba spojiti još računala (trenutno samo laptop).
E sad, ideja je sljedeće:
INTERNET << == >> ROUTER << == >> eth0 DESKTOP PC eth1 << == >> switch << == >> eth0 notebook
Prva ideja je bila preko iptables:
- Kod: Označi sve
iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -X
# Always accept loopback traffic
iptables -A INPUT -i lo -j ACCEPT
# Allow established connections, and those not coming from the outside
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -m state --state NEW -i ! eth1 -j ACCEPT
iptables -A FORWARD -i eth1 -o eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
# Allow outgoing connections from the LAN side.
iptables -A FORWARD -i eth0 -o eth1 -j ACCEPT
# Masquerade.
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
# Don't forward from the outside to the inside.
iptables -A FORWARD -i eth1 -o eth1 -j REJECT
# Enable routing.
echo 1 > /proc/sys/net/ipv4/ip_forward
- Kod: Označi sve
ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:1A:92:E8:E6:3B
inet addr:192.168.1.3 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::21a:92ff:fee8:e63b/64 Scope:Link
UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1
RX packets:96875 errors:0 dropped:0 overruns:0 frame:0
TX packets:67846 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:39440963 (37.6 Mb) TX bytes:9391413 (8.9 Mb)
Interrupt:27 Base address:0xa000
eth1 Link encap:Ethernet HWaddr 00:06:4F:76:BD:D0
inet addr:192.168.1.50 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::206:4fff:fe76:bdd0/64 Scope:Link
UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1
RX packets:235001 errors:0 dropped:0 overruns:0 frame:0
TX packets:507742 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:14356708 (13.6 Mb) TX bytes:762617494 (727.2 Mb)
Interrupt:18 Base address:0x2400
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:18780 errors:0 dropped:0 overruns:0 frame:0
TX packets:18780 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:653963 (638.6 Kb) TX bytes:653963 (638.6 Kb)
no ne želi raditi... uspio sam podesiti bridge preko bridge-utils (brctl); na laptopu radi OK; no onda nemam pistup na desktop računalu što mi opet odgovara.
Znači, ono što meni treba je da sav promet sa eth1 proslijedi dalje preko eth0 (svi portovi, svi protokoli). ima netko kakvu ideju?