OpenWrt Forum Archive

Topic: Mutilple wan ports?

The content of this topic has been archived on 2 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

After hours upon hours of trying to get the router to accept 2 ip addressess.  Recently found out that aliases and dhcp don't mix.  I decided to take a different approach.  I will do my best to explain what I am trying to do.  I want to be able to connect port 1 to port 0 (wan port) in a true switch fasion, while leaving the other ports behind the lan.  I have added port 1 to vlan1 to no avail.  I also tried just removing it completely, which also did not work.  If the router is just a switch this should be possible, but the vlans give me a headache.  Including some ascii art to reiterate what I am trying to accomplish.

                 modem <----> router <---- port 1 ----->public ip
                                       |  |  |
                                       |  |  |
                                    private ips
                                      /   |   \
                                    /     |     \
                            port2   port3    port4

what kind of router is this Linksys WRT54G ?
your 1st (public ip), are getting from ISP via dhcp right ?

I did this with my WRT54G v3 with OpenWrt
ok start from the scratch.
you'll have to brake the bridge.
now make your port1 as vlan2

not only bridge you will have to brake the vlan0 too. cause your normal vlan0ports like ths vlan0prots=0 1 2 3 4 5*
now
here is how I brake vlan0 and create vlan2, remember vlan1 is your WAN ?


nvram set vlan2hwname=et0
nvram set vlan0ports="2 3 4 5*"
nvram set vlan2ports="1 5"
nvram set port1_ifname=vlan2
nvram set port1_hwaddr=BA:DB:EF:D7:1D:D4
nvram set port1_proto=static <-- you can make this dhcp or static mine is static
nvram set port1_ipaddr=192.168.151.1  <---any address you want to
nvram set port1_netmask=255.255.255.252
nvram set port1_mtu=1500

nvram commit

then remove:- rm /etc/init.d/S40network
copy:- cp /rom/etc/init.d/S40network /etc/init.d/S40network

now edit /etc/init.d/S40network
add ifup port1 under "ifup lan"

now set your default gateways to route your traffic the way you want
and put you iptables rules to forward WAN traffic via WAN and PORT1

happy networking !

Wireless Joe

(Last edited by wirelessjoe on 19 May 2005, 14:02)

I don't think that is what I want to do.  I don't want port 1 to talk to the router at all but to be connected to the internet directly through the wan port.  I want port 1 to act as though it were connected to a switch in front of the router.  Is this even possible.  From what I can tell the switch is configured by the et driver.  I haven't been able to find any info on how I might be able to use it to configure the switch to do what I want.

And yes, it is a wrt54g V2.2.  My isp allocates 3 dynamically assigned ip addresses.  I want to use two of them, but I do not want to have to connect a separate switch in front of the router if it can be avoided.  It seems to me that this would be trivial, but maybe it is beyond the capabilities of the hardware/drivers.


Perhaps now that I have that port independant of the bridge, I could figure out how to tell iptables not to nat it and somehow get it to forward broadcast messages from it.

(Last edited by jon on 17 May 2005, 05:04)

Nevermind.  It looks like it was an issue with my modem.  I can get it to work by simply moving port 1 into vlan1.

(Last edited by jon on 17 May 2005, 14:47)

This is exactly what I've been trying to do, but with aliases and DHCP relays and all sorts of Wrong Ideas.

Moving port 1 to vlan1 allows me to get an IP address from the ISP's DHCP server, but I'm not able to ping anything.  Is the router still trying to do some NAT on port1 that I need to disable?

aha that is why ? I use $10.00 switch infront of my router. no headache

however you should tr to set gateway address and enable proxy_arp ...etc

Joe

kidgoo wrote:

This is exactly what I've been trying to do, but with aliases and DHCP relays and all sorts of Wrong Ideas.

Moving port 1 to vlan1 allows me to get an IP address from the ISP's DHCP server, but I'm not able to ping anything.  Is the router still trying to do some NAT on port1 that I need to disable?

AKAIK, aliasing only works with static addresses.  When you say you cannot ping anyting, does that include both internal addresses and external?

Yes...I can ping nothing at all.
Using tcpdump I can see lots of ARP packets from the ISP's DHCP servers, and I can also see traffic within the local network here.  I don't think I should be able to see the local traffic...is that right?

In you other thread you said it was connected by both wired and wireless connections, so yes, you would still see local traffic on the wireless interface.

That is the ultimate goal...to allow the remote dhcp server to assign ip addresses even to a computer connected by wifi.  What I have currently is just with one wired computer connected to port 1, which has been moved to vlan1.  I think it shouldn't see local network traffic because if it's acting as a switch, then the packets from the wan interfaces should never escape the hardware switch chip in the router...unless I'm confused.

Did you forget to take port 1 out of vlan0?

Nope...the nvram settings are:

vlan0ports=2 3 4 5*
vlan1ports=0 1 5

Is there another setting I need to modify?

The discussion might have continued from here.