1

I tried to setup static ip for wired internet, but I only managed to do so for my wireless internet. I cannot connect. Here's various files and command I run to test.

$ ping 8.8.8.8
connect: Network is unreachable

$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     0.0.0.0         255.255.255.0   U     202    0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     303    0        0 wlan0


$ ifconfig
eth0      Link encap:Ethernet  HWaddr b8:27:eb:2b:33:ac
          inet addr:192.168.1.149  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::6c12:1cd9:a953:751b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:274 errors:0 dropped:0 overruns:0 frame:0
          TX packets:879 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:22697 (22.1 KiB)  TX bytes:122902 (120.0 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:72 errors:0 dropped:0 overruns:0 frame:0
          TX packets:72 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:6288 (6.1 KiB)  TX bytes:6288 (6.1 KiB)

wlan0     Link encap:Ethernet  HWaddr b8:27:eb:7e:66:f9
          inet addr:192.168.1.150  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::fc8b:8737:c272:c6bd/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1818 errors:0 dropped:455 overruns:0 frame:0
          TX packets:67 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:179574 (175.3 KiB)  TX bytes:9939 (9.7 KiB)

/etc/network/interfaces

auto wlan0
auto lo

iface lo inet loopback

allow-hotplug eth0
iface eth0 inet manual

allow-hotplug wlan0
iface wlan0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

/etc/dhcpcd.conf

interface eth0
static ip_address=192.168.1.149/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1

interface wlan0
static ip_address=192.168.1.150/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1

Is there a problem with my setup?

Poon
  • 11
  • 1
  • Try to : sudo systemctl stop networking and then sudo systemctl restart dhcpcd and then check the config – MatsK Sep 20 '17 at 16:20

1 Answers1

1

"Is there a problem with my setup?"

It depends; asssuming you are using Raspbian Jessie, you appear to have successfully set static IP according to what you have specified in /etc/dhcpcd.conf, but we have no way of knowing if this is correct, although I may ask WHY?

See How do I set up networking/WiFi/Static IP

You should use ip r rather than the deprecated route -n. This provides the same information, but is much clearer.

Milliways
  • 59,890
  • 31
  • 101
  • 209