Routing problem : two interfaces one gateway

hi folks,

i have a horstbox-router with the following configuration.

it has 4 ethernet ports from wich one (wan0) is configured as an external modem via dhcp. at this port/interface(wan0) it is connected with my home network (other switch).

this configuration results in the following routing table :

route 

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.2.0     *               255.255.255.0   U     0      0        0 br0
192.168.2.0     *               255.255.255.0   U     0      0        0 wan0
default         192.168.2.1     0.0.0.0         UG    0      0        0 wan0

so the router has internal acces to internet and can use voip from lan port 1 (wan0) which is the connected with a cable to my home network.

but on the other lan-ports i don't have internet acces or even acces to my home network. because it has no default gateway ?!

what command can i use to connect the interfaces br0 and wan0. or is it possible to route the traffic from br0 to wan0 ?

thanks in advance

"connect" how? What do you want sent from what to where? How will it manage to forward anything to anyone without a gateway?

this is the horstbox

there are 4 blue ethernet ports. i am sorry but i have no deep knowledge in ip.

the first lan port (wan0 interface) is connected to my home network like i noticed before. if i connect with putty to the router on a shell i can ping an internet address. so the traffic seems to go over the wan0 interface and the standard gateway 192.168.2.1. thats good and ok.

but if i connect another device on lan port 2 -4 (br0) it gets no ip address from dhcp. there is no connection to my home network.

i am not sure what is the solution to this problem because of my limited knowledge to ip.

but the solution to me should be that when i connect another device to lan port 2-4 (br0) it should get acces to my home network (dhcp, internet etc).

any ideas ?

But if no interfaces have a default gateway, how can any information get anywhere?

route 

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.2.0     *               255.255.255.0   U     0      0        0 br0
192.168.2.0     *               255.255.255.0   U     0      0        0 wan0
default         192.168.2.1     0.0.0.0         UG    0      0        0 wan0

as you can see the interface wan0 has a default gateway. 192.168.2.1 is my cable-network-router.

as far as i can see it is not possible to add a second default gateway (for the other lan-ports 2-4).

If you wanted your router to route, you would have its IP address be the gateway for the things behind it.

If you don't want it to do any routing at all and just join all the ports together in a big virtual switch, make them all part of br0. Note that firewall rules still apply to traffic forwarded over a bridge.

i have a few problems. my ip knowledge is limited. and i only have a busybox linux on the horstbox-router.

so is it possible to "bridge" the interfaces per command line ? does this make sense ?

I take it you mean you do want to just bridge them all together and not do any routing. Trying could be dangerous, it's not a minor change -- it's effectively ditching the "wan" device and making everything part of "br0". And since this is an embedded device, one slip-up and you've "bricked" it. I wouldn't recommend it.

Why not just plug everything into the LAN ports?

the device has a read-only system. so after reboot everything is as before.

when plug the lan-cable to my network switch to the lan2 (br0) then it works like a switch and auto-configures the lan-ports. so i can use lan2 lan3 and lan4 like a normal switch. BUT

then the internal link to the internet is not there and the internal voip-program has no connection to the internet and cannot connect to my sip-account.

when i disable wan0 with

ifconfig wan0 down

and add the default gw with

route add default gw 192.168.2.1 br0

everything works like it should (router cann connect to sip-account, devices on lan1 - lan4 have inet). but i need to configure this on every reboot, and that is really annoying.

so is there an option to bridge or do something like this.

If you cannot change the router's configuration, then anything you do isn't going to be permanent, bridge or not.

see 'brctl' for how software bridges are managed, but you'd have to get the router to stop messing with the 'wan' interface and use 'br0' instead somehow.

yes you are right. but if i leave the configuration like i have now. at least the sip-account works on reboot. that is because the lan1 port is configured to be a fake external modem with dhcp. this is what the user interface allows. but i can't use lan2-4.

brctl is not available :frowning:

the following commands are avalable :

expr            kill            ping            top
ash             false           killall         pivot_root      touch
basename        fgrep           klogd           ppf             tr
busybox         free            ln              ps              true
callsetupunit   fsck.msdos      logger          pwd             tty
cat             fsck.vfat       login           reboot          udhcpc
chmod           fxo             logread         rm              udhcpr
config.ini      getopt          ls              rmmod           umount
cp              getty           mkdir           route           uname
cut             grep            mknod           sh              uptime
date            gunzip          modprobe        sleep           usleep
dd              gzip            modprobe.sh     syslogd         vi
dmesg           hostname        more            t38.ini         wget
dosfsck         ifconfig        mount           tail            zcat
dropbearkey     init            mv              tapidemo
dumpleases      insmod          oamctl          tar
echo            iwconfig        oamd            test
env             iwpriv          passwd          tftp

If brctl is not available, you cannot bridge.

ok. so i have to do trial and error to achieve a solution. thanks for your help.

i ll give feedback if any solution will work.

i found out that there is the command brctl. it was in another directory which was not in the path. the output is the following.

# ./brctl show
bridge name     bridge id               STP enabled     interfaces
br0             8000.001b11b444de       no              eth1

again the output of route is

# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.2.0     *               255.255.255.0   U     0      0        0 br0
192.168.2.0     *               255.255.255.0   U     0      0        0 wan0
default         192.168.2.1     0.0.0.0         UG    0      0        0 wan0

ip route show delivers

# ./ip route show
192.168.2.0/24 dev br0  proto kernel  scope link  src 192.168.2.4
192.168.2.0/24 dev wan0  proto kernel  scope link  src 192.168.2.127
default via 192.168.2.1 dev wan0

ip link show delivers

# ./ip link show
1: lo: <LOOPBACK,UP> mtu 16436 qdisc noqueue
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: MEI_PHY: <UP> mtu 0 qdisc noop
    link/[94]
3: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
    link/ether 00:1b:11:b4:44:dd brd ff:ff:ff:ff:ff:ff
4: eth1: <BROADCAST,MULTICAST,PROMISC,UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:1b:11:b4:44:de brd ff:ff:ff:ff:ff:ff
5: gre0@NONE: <NOARP> mtu 1476 qdisc noop
    link/gre 0.0.0.0 brd 0.0.0.0
6: br0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue
    link/ether 00:1b:11:b4:44:de brd ff:ff:ff:ff:ff:ff
7: wifi0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 199
    link/ether 00:19:5b:ed:63:44 brd ff:ff:ff:ff:ff:ff
8: wan0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 0a:1b:11:b4:44:de brd ff:ff:ff:ff:ff:ff
#

i think i need to remove br0 and bridge wan0 to eth1. but i am not sure.

again wan0 is the ehternet port which is connected to my homenetwork (switch).

if i try to remove the interface from the bridge br0 i loose my ssh-connection to the router. so this is no option. removing the bridge does not work because it is denied by brctl. i am a little stuck right now because of my limited knowledge to ip.

i repeat myself but with the recent permanten configuration the internal sip-telephony which needs access to internet works. for a solution i need a simple command that i can enter from the console to use the lan2-4 ports.
any ideas ? thx in advance.

It might be helpful to post a sketch of your entire setup. A LAN port called WAN0 seems at least puzzling to me. That thing being an ADSL router, I'd guess WAN0 should be somehow directed to the world via ADSL...
I'm not sure bridging is needed to use all the LAN ports including DHCP.
And, the gateway for devices connected should be the router itself, for the router it should be the provider's concentrator (or so).