OpenWrt Forum Archive

Topic: Static IP in LAN and WAN and Internet access in LAN

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

First of all thanks for reading my question, and for any help you can give me.

Ok here is the problem I have a network that is a bit strange but I need it to be like this.

I need to have N different networks with the same configuration each one with a private access to the internet, but also I need to share a server by them all.

So I am using a custom openwrt firmware on a TP-Link WR842ND.
What I did was to configure all routers (with dnsmasq disabled so it does not ghave a dhcp server) with the same IP address and I conneced the PC to the router ports. And to have internet acces I connected the router/modem to the last port of the router TP-Link WR842ND.

Each TP-Link WR842ND is connected via WAN to a switch. This switch also has the server (with the shared services) connected.
http://i.minus.com/i7JBTnruADBp3.png


In order for this to work I need to have the LAN and the WAN with static IP. I am using the folowing configuration in /etc/config/network:

 
config interface 'loopback'
    option ifname 'lo'
    option proto 'static'
    option ipaddr '127.0.0.1'
    option netmask '255.0.0.0'

config interface 'lan'
    option ifname 'eth0'
    option proto 'static'
    option netmask '255.255.255.0'
    option ipaddr '192.168.1.7'
    option gateway '192.168.1.254'
    option dns '192.168.1.254'

config interface 'wan'
    option ifname 'eth1'
    option proto 'static'
    option netmask '255.255.0.0'
    option ipaddr '10.10.0.1'
    option gateway '10.10.0.254'

config switch
    option name 'eth0'
    option reset '1'
    option enable_vlan '1'

config switch_vlan
    option device 'eth0'
    option vlan '1'
    option ports '0 1 2 3 4'

But with this configuration I do not have access to the internet on the router TP-Link.

Is there a way to do this? What am I doing wrong?

NOTE:
If I put the WAN in DHCP I can have internet access.

(Last edited by edsousa84 on 14 Aug 2012, 15:44)

You also need to set a DNS server within the wan interface config, e.g.  option dns '8.8.8.8 8.8.4.4'

You also need to set a DNS server within the wan interface config, e.g.  option dns '8.8.8.8 8.8.4.4'

Did not work i tried 3 times with diferent dns servers.

NOTE: The switch does not connect to the internet and it does not have a dns server connected to it

1) the same as the lan
2) one in the same network as the wan 10.10.0.100
3) and a complete random..like 123.123.123.123

None of them worked

Oh I see you have the physical gateway attached to your lan, then obviously delete the gateway from the wan config. There must be only one single gateway in the config.

Yes i think that was the problem. I think that it is working...

Thanks...

The discussion might have continued from here.