This is a discussion on help about bridging... within the Linux Networking forums, part of the Linux Forums category; Hello, I'm trying to set up a little server that can share an internet connection with two clients WITHOUT ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hello,
I'm trying to set up a little server that can share an internet connection with two clients WITHOUT any router/hub/switch. This is my network: [client_1]:eth0(192.168.7.2) ========\ eth0:(192.168.7.1)[//////] [//////] [client_2]:eth0(192.168.7.3) ====== eth1:(192.168.7.10)[server] [//////] eth2:(192.168.7.100)[//////] [adsl_mdm]:=========================/ Problem: If I try to ping (from server) client_1, that's ok. If I try to ping (from server) client_2, I have no response. So, I try to specify an interface as ping source with -I. # ping 192.168.7.3 -I eth1 bad interface address 'eth1' Huh? Why? eth1 Device is correctly installed and its IP address was correctly set by ifconfig. ifconfig shows it. The same thing also happens with the other two ethernet cards, eth0 and eth2... However, client_1 can access to the internet using 192.168.7.1 as gateway, but client_2 seems to be absolutely out of the net! I've find out many tutorials that "solve" my problem simply setting up a bridge with brctl, but noone of these really work with my network configuration. All of this tutorials start with the rule "all clients can be reached with a simple ping by the server". So.. what can I do? Anyone can help me? Note that ip_forward option was already set to "1". Thanks in advance, Odin_Eidolon |
|
|||
|
On Mon, 28 Feb 2005, Odin_Eidolon <odin.eidolon@bauasdbau.org> wrote:
> Hello, > I'm trying to set up a little server that can share an internet > connection with two clients WITHOUT any router/hub/switch. > This is my network: > > > [client_1]:eth0(192.168.7.2) ========\ > eth0:(192.168.7.1)[//////] > [//////] > [client_2]:eth0(192.168.7.3) ====== eth1:(192.168.7.10)[server] > [//////] > eth2:(192.168.7.100)[//////] > [adsl_mdm]:=========================/ > > > Problem: > > If I try to ping (from server) client_1, that's ok. > If I try to ping (from server) client_2, I have no response. > So, I try to specify an interface as ping source with -I. > > # ping 192.168.7.3 -I eth1 > bad interface address 'eth1' > > Huh? Why? eth1 Device is correctly installed and its IP address > was correctly set by ifconfig. ifconfig shows it. > The same thing also happens with the other two ethernet cards, > eth0 and eth2... What is output of: /sbin/route -n I imagine your routing conflicts, because you configured 3 interfaces with same network (netmask), and first route to 192.168.7.3 is eth0. The secret is to either split them in to different subnets or simply set netmask of eth0 and eth1 to 255.255.255.255, with -host route to IP of PC on each: route add -host 192.168.7.2 dev eth0 route add -host 192.168.7.3 dev eth1 Then enable proxy arp on eth2: echo 1 > /proc/sys/net/ipv4/conf/eth2 > However, client_1 can access to the internet using 192.168.7.1 > as gateway, but client_2 seems to be absolutely out of the net! > I've find out many tutorials that "solve" my problem simply > setting up a bridge with brctl, but noone of these really work > with my network configuration. All of this tutorials start with > the rule "all clients can be reached with a simple ping by the > server". > > So.. what can I do? Anyone can help me? > Note that ip_forward option was already set to "1". > > > > Thanks in advance, > Odin_Eidolon -- David Efflandt - All spam ignored http://www.de-srv.com/ http://www.autox.chicago.il.us/ http://www.berniesfloral.net/ |
|
|||
|
David Efflandt wrote:
> What is output of: /sbin/route -n # route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Ifce 192.168.100.1 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0 192.168.7.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 192.168.7.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 192.168.7.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2 0.0.0.0 192.168.100.1 0.0.0.0 UG 0 0 0 ppp0 > I imagine your routing conflicts, because you configured 3 interfaces with > same network (netmask), and first route to 192.168.7.3 is eth0. The > secret is to either split them in to different subnets or simply set > netmask of eth0 and eth1 to 255.255.255.255, done. # ifconfig eth0 inet addr:192.168.7.1 Bcast:192.168.7.255 Mask:255.255.0.0 (...) eth1 inet addr:192.168.7.10 Bcast:192.168.7.255 Mask:255.255.0.0 (...) eth2 inet addr:192.168.7.100 Bcast:192.168.7.255 Mask:255.255.255.0 (...) lo inet addr:127.0.0.1 Mask:255.0.0.0 (...) ppp0 inet addr:82.49.116.130 P-t-P:192.168.100.1 Mask:255.255.255.255 (...) > with -host route to IP of PC > on each: > > route add -host 192.168.7.2 dev eth0 > route add -host 192.168.7.3 dev eth1 done. This is my `route -n` after changes: # route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Ifce 192.168.100.1 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0 192.168.7.2 0.0.0.0 255.255.255.255 UH 0 0 0 eth0 192.168.7.3 0.0.0.0 255.255.255.255 UH 0 0 0 eth1 192.168.7.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2 192.168.7.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0 192.168.7.0 0.0.0.0 255.255.0.0 U 0 0 0 eth1 0.0.0.0 192.168.100.1 0.0.0.0 UG 0 0 0 ppp0 > Then enable proxy arp on eth2: > echo 1 > /proc/sys/net/ipv4/conf/eth2 done. # cat /proc/sys/net/ipv4/conf/eth2/proxy_arp 1 Great! Now: - the server can reach client_1 and client_2 - client_1 can reach 192.168.7.1,10,100 - client_2 can reach 192.168.7.1,10,100 ...but client_1 can't reach client_2 and client_2 can't reach client_1. Maybe I have to set up the bridge? Between eth0 and eth1? I'm waiting your answer before trying the 'bridge' solution. However, thank you very much for the time you've spent with me. ....and sorry for my bad english! ;) -- Odin_Eidolon |
|
|||
|
Odin_Eidolon wrote:
[...] > I'm waiting your answer before trying the 'bridge' solution. [...] ....but I'm sooooo impatient! ;) So I've tried it and now the routing is ok! This is what I've done: # modprobe bridge # modprobe ip_conntrack # modprobe iptable_nat # modprobe ipt_MASQUERADE # ifconfig eth0 192.168.7.10 up netmask 255.255.255.0 # ifconfig eth1 192.168.7.100 up netmask 255.255.255.0 # brctl addbr br0 # brctl addif br0 eth0 # brctl addif br0 eth1 # ifconfig br0 192.168.7.1 up netmask 255.255.0.0 # echo "1" > /proc/sys/net/ipv4/ip_forward # route add -host 192.168.7.2 dev eth0 # route add -host 192.168.7.3 dev eth1 # route add -host 192.168.7.2 dev br0 # route add -host 192.168.7.3 dev br0 # iptables -t nat -A POSTROUTING -d ! 192.168.7.0/24 -j MASQUERADE This is my routing table now: # route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.100.1 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0 192.168.7.2 0.0.0.0 255.255.255.255 UH 0 0 0 br0 192.168.7.2 0.0.0.0 255.255.255.255 UH 0 0 0 eth0 192.168.7.3 0.0.0.0 255.255.255.255 UH 0 0 0 br0 192.168.7.3 0.0.0.0 255.255.255.255 UH 0 0 0 eth1 192.168.7.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 192.168.7.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 192.168.0.0 0.0.0.0 255.255.0.0 U 0 0 0 br0 0.0.0.0 192.168.100.1 0.0.0.0 UG 0 0 0 ppp0 I'm really happy and ready to have a good night! :D Thank you for helping me, have a goodnight too! Saludos, Odin_Eidolon |