Static IP set, but no internet access?
-
I set a static IP address for my Onion2+. Once I do that, I seem to no longer have internet access.
Local wireless router is 192.168.1.1
Static IP needed for the Onion is 192.168.1.202Somehow, I seem to have set this up wrong. Any help appreciated !
ifconfig and /etc/config/network shown below
root@Omega-5F4C:~# ifconfig
apcli0 Link encap:Ethernet HWaddr 40:A3:6B:C9:5F:4E
inet addr:192.168.1.202 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::42a3:6bff:fec9:5f4e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 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:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)br-wlan Link encap:Ethernet HWaddr 40:A3:6B:C9:5F:4C
inet addr:192.168.3.1 Bcast:192.168.3.255 Mask:255.255.255.0
inet6 addr: fe80::42a3:6bff:fec9:5f4c/64 Scope:Link
inet6 addr: fd1d:48c4:7633::1/60 Scope:Global
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:932 errors:0 dropped:0 overruns:0 frame:0
TX packets:587 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:134785 (131.6 KiB) TX bytes:57535 (56.1 KiB)eth0 Link encap:Ethernet HWaddr 40:A3:6B:C9:5F:4D
inet6 addr: fe80::42a3:6bff:fec9:5f4d/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:59 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:17583 (17.1 KiB)
Interrupt:5lo 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:10 errors:0 dropped:0 overruns:0 frame:0
TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:640 (640.0 B) TX bytes:640 (640.0 B)ra0 Link encap:Ethernet HWaddr 40:A3:6B:C9:5F:4C
inet6 addr: fe80::42a3:6bff:fec9:5f4c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1033 errors:0 dropped:0 overruns:0 frame:0
TX packets:576 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:169323 (165.3 KiB) TX bytes:47803 (46.6 KiB)
Interrupt:6here is my /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 globals 'globals'
option ula_prefix 'fd1d:48c4:7633::/48'config interface 'wlan'
option type 'bridge'
option proto 'static'
option hostname'MSPPlaner'
option netmask '255.255.255.0'
option ip6assign '60'
option ipaddr '192.168.3.1'
option dns-nameservers '75.75.75.75'config interface 'wwan'
option ifname 'apcli0'
option proto 'static'
option ipaddr '192.168.1.202'
option netmask '255.255.255.0'
option hostname 'PVPlanerconfig interface 'wan'
option ifname 'eth0'
option proto 'dhcp'
-
@Jim-W It looks ok to me, so I wonder if the issue is your DNS. Can you ping 8.8.8.8 and 8.8.4.4 ?
If receive a response then this is s DNS setup issue. When you use a static IP your're not using DHCP protocol which not only provides your IP but also provides your DNS configuration. Edit /etc/resolv.conf and add your DNS configuration here. If you're not sure which DNS to use you can use Google's which are the IPs I asked you to ping above. Like so:
Interface wwan
nameserver 8.8.8.8
nameserver 8.8.4.4
search localdomain
-
root@Omega-5F4C:~# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
ping: sendto: Network unreachable
root@Omega-5F4C:~#Strange. I edited the resolv.conf to be
nameserver 8.8.8.8
nameserver 8.8.4.4
search local domainand saved it. Just to check I did a cat /etc/resolv.conf and is came back correctly.
I rebooted the machine. Still wont ping. Checked resolv.conf and is has been changed back to its original
search lan
nameserver 127.0.0.1??
Still cannot ping 8.8.8.8
Looks like something is overwriting resolv.conf at reboot?
-
@Jim-W The resolv.conf being overwitten will be caused by dnsmasq but if you can't ping then that is the issue that need to be sorted.
Can you ping 192.168.1.1 ?
Please post /etc/config/wireless and the output of route -e
-
Could not ping 192.168.1.1
However, found a solution in post Setting DNS with static IP config (not sure how I missed it in my initial search).Changes wwan to
config interface 'wwan'
option ifname 'apcli0'
option proto 'static'
option hostname 'Omega-XXXX'
option ipaddr '192.168.1.202'
option netmask '255.255.255.0'
option gateway '192.168.1.1'
option dns '8.8.8.8'and added a line to rc.local
route add default gw 192.168.1.1
That seemed to do the trick. I can ping the www (and more importantly the ntp server I needed to get the time from).
Thank you for your assistance
-
@Jim-W The configuration changes you show are correct, personally I prefer to place them in the wireless config but either is fine. Adding the route to rc.local is not required.