OpenWrt Forum Archive

Topic: [SOLVED] Connect OpenWRT to Internet through another router

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

Hi all,

I have a Huawey 556a-B. I would like to use it to have Internet via a 3G USB stick

As I was not able to do it with the original Vodafone firmware, I decided (I was keen to) install OpenWRT.

I've installed this version LEDE Reboot 17.01.1 r3316-7eb58cf109 / LuCI lede-17.01 branch (git-17.100.70571-29fabe2).

Then, in order to install all the packages needed to use the 3G stick, I connected it to my main router via a LAN cable (LAN1 port) (The Huawey 556a has ADSL connector instead of WAN). Main router is 192.168.1.1. I configured the Huawey with 192.168.1.2

The fist issue was with DNS. After connecting the Huawey to LAN, my computer was not able to resolve any
host name. I disabled the Huawey DNS server by setting to 0 the DNS port, through LUCI. This solved the problem.

I then connected to the router via ssh. A ping to 8.8.8.8 was not working. I added the main router as a gateway with
"route add default gw 192.168.1.1 br-lan". Now the previuos ping is working properly, but ping to w3.google.com gives a "bad address" message.
And here is where I'm stuck. I've added a DNS through LUCI. Still the same. I've modified the /etc/resolv.conf file adding "nameserver 8.8.8.8" but When I rebooted the system, the file was overwritten.
I've added the server trhough these UCI commands:
uci add_list dhcp.@dnsmasq[-1].server=8.8.8.8
uci add_list dhcp.@dnsmasq[-1].server=8.8.4.4
uci commit dhcp
Still no success.

This is the result of ifconfig:
br-lan    Link encap:Ethernet  HWaddr 28:5F:DB:16:0F:EC 
          inet addr:192.168.1.2  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::2a5f:dbff:fe16:fec/64 Scope:Link
          inet6 addr: fdc6:aca7:a820::1/60 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1762 errors:0 dropped:0 overruns:0 frame:0
          TX packets:229 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:203198 (198.4 KiB)  TX bytes:25513 (24.9 KiB)

eth0      Link encap:Ethernet  HWaddr 28:5F:DB:16:0F:EC 
          inet6 addr: fe80::2a5f:dbff:fe16:fec/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1765 errors:0 dropped:0 overruns:0 frame:0
          TX packets:248 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:235106 (229.5 KiB)  TX bytes:28263 (27.6 KiB)
          Interrupt:14

eth0.1    Link encap:Ethernet  HWaddr 28:5F:DB:16:0F:EC 
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1765 errors:0 dropped:0 overruns:0 frame:0
          TX packets:229 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:203336 (198.5 KiB)  TX bytes:25513 (24.9 KiB)

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)


This is the result of route:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.1.1     0.0.0.0         UG    0      0        0 br-lan
192.168.1.0     *               255.255.255.0   U     0      0        0 br-lan

This is how my resolv.conf file looks like
root@LEDE:~# cat /etc/resolv.conf
search lan
nameserver 127.0.0.1

cat /etc/config/dhcp

config dnsmasq
    option domainneeded '1'
    option boguspriv '1'
    option localise_queries '1'
    option rebind_protection '1'
    option rebind_localhost '1'
    option local '/lan/'
    option domain 'lan'
    option expandhosts '1'
    option authoritative '1'
    option readethers '1'
    option leasefile '/tmp/dhcp.leases'
    option resolvfile '/tmp/resolv.conf.auto'
    option localservice '1'
    option port '0'
    option nonwildcard '0'
    list server '8.8.8.8'
    list server '8.8.4.4'

config dhcp 'lan'
    option interface 'lan'
    option start '100'
    option limit '150'
    option leasetime '12h'
    option dhcpv6 'server'
    option ra 'server'
    option ra_management '1'

config dhcp 'wan'
    option interface 'wan'
    option ignore '1'

config odhcpd 'odhcpd'
    option maindhcp '0'
    option leasefile '/tmp/hosts/odhcpd'
    option leasetrigger '/usr/sbin/odhcpd-update'


Every line in dnsmasq.conf file is comented, so I guess is not worthy to reporduce it here

I'm not an expert on these stuff so I guess I'm doing something wrong, but I can't figure out what it can be.

Any help would be very wellcome. Thank you very much in advance

Regards

Xavi

(Last edited by xavinab on 31 Jul 2017, 06:38)

Turn off the DHCP server in your LEDE router.

Configure options gateway and dns in the lan network to point to the main router.

Hi mk24,

Thanks for your answer.

I've done what you suggest. Unfortunately, still the same. I've also reboot the router just in case the "Save & apply" button was not enough, but no success.

Reset to default settings and start over.  All that you need to change is on the LAN interface page:
set static IP to 192.168.1.2
set gateway and DNS to 192.168.1.1 (your main router)
disable DHCP (check the box to disable v4, also go to the IPV6 tab and disable those.)

(Last edited by mk24 on 24 Jul 2017, 23:09)

Hi mk24,

Yessssss. Now it works fine!!!!

Thanks a lot

The discussion might have continued from here.