OpenWrt Forum Archive

Topic: WRT54G 2 WAN ip addresses?

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

I have 2 public ip addresses that terminate on my DSL modem. They aren't on the same subnet, but they do share the same first 2 octets. Currently, I have a linux box with a single NIC that has a one ip address assigned to eth1 and a second ip address assigned to the virtual adapter eth1:0.

What I'd like to do is have the WRT54G take over that role (and several others). Is this possible?

Further, in the current setup, I use the 2 different ip addresses to host 2 different websites. How would I accomplish the same thing if I put the WRT54G at the edge of the network instead of the linux box?

...Kevin (almost ready to make the leap)

It's pretty simple -

wan_ifname=vlan1
wan_proto=static
wan_ipaddr=x.x.x.x

wan1_ifname=vlan1:0
wan1_proto=static
wan1_ipaddr=x.x.x.x

ifup wan; ifup wan1

The "ifup wan" is already in S40network; you'll need to add "ifup wan1". It doesn't need to be called wan1, almost any other name will work as long as you aren't conflicting with any other nvram variables.

For inbound connections you'll need a few rules to make sure it replies with the address the packet was sent to. You should be able to find that using google -- if I remember right it's either the multihoming howto or the advanced routing howto.

thanks for that confirmation mbm. It really seems like this OpenWrt project has the bases covered. Thanks to you and the others for the great work in putting it out there. And in a no-strings-attached manner.

...Kevin

mbm wrote:

It's pretty simple -

wan_ifname=vlan1
wan_proto=static
wan_ipaddr=x.x.x.x

wan1_ifname=vlan1:0
wan1_proto=static
wan1_ipaddr=x.x.x.x

ifup wan; ifup wan1

Ok, I did:

nvram show | grep "wan"

Looking at that output I figured I should to the following commands:

nvram set wan1_iface=vlan1:0
nvram set wan1_proto=static
nvram set wan1_ipaddr=209.xxx.xxx.xxx
nvram set wan1_netmask=255.255.255.224
nvram set wan_ifnames="vlan1 vlan1:0"
nvram commit

The "ifup wan" is already in S40network; you'll need to add "ifup wan1". It doesn't need to be called wan1, almost any other name will work as long as you aren't conflicting with any other nvram variables.

It seems like the wan_ifnames is setup for multiple addresses already?

For inbound connections you'll need a few rules to make sure it replies with the address the packet was sent to. You should be able to find that using google -- if I remember right it's either the multihoming howto or the advanced routing howto.

This is the part I still have to work out. I think it will depend somewhat on how Apache wants to handle the 2 different virtual hosts that are defined.

...Kevin

The discussion might have continued from here.