1

I configured "/etc/network/interfaces" config file as such :

auto lo
iface lo inet loopback

iface eth0 inet manual

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

and configured dhcpcd.conf by adding these lines at the end of file:

# Custom static IP address for eth0.
interface eth0
static ip_address=192.168.1.115/24
static routers=192.168.1.1

# Custom static IP address for wlan0.
interface wlan0
static ip_address=192.168.1.114/24
static routers=192.168.1.1

With these configurations , I see my ethernet and wifi interfaces get specified ips successfully. Wireless connection is done also. But when i open web browser and try to reach a webpage, It just doesnt happen.

Şansal Birbaş
  • 121
  • 1
  • 4
  • 1
    Why have you tried to give 2 interfaces the same ip_address? (I could also ask why bother with static in the first place - no one seems to need to do this on Windows or OSX.) – Milliways Oct 18 '16 at 11:19
  • @Milliways I tried your suggestion. But nothing has changed. – Şansal Birbaş Oct 18 '16 at 14:48
  • 1
    @ŞansalBirbaş, what are the results of `ping 192.168.1.1` and `nslookup www.google.com` ? Paste on your question post. – vaha Oct 18 '16 at 15:11
  • @ŞansalBirbaş, based on your comments under my answer I think it would be helpful to add some clarifying details to the question. For example, are eth0 and wlan0 on the same physical network (i.e. connecting to the same router)? If so, why use 2 interfaces (wlan and eth). If not, why use a 192.168.1 network for both networks. Details like this could help those trying to assist. – thephez Oct 18 '16 at 21:46
  • 1
    You could try setting in `/etc/dhcpcd.conf` as per its documentation, example in [How do I set up networking/WiFi/Static IP](http://raspberrypi.stackexchange.com/a/37921/8697) with instructions for determining parameter values. Most of the other comments seem speculative. I still don't see why so many Pi users want to set static IP addresses - I did this when I setup my 1st network in 1980, but now let the computer do the work. – Milliways Oct 19 '16 at 00:19
  • @thephez You are right. Well , actually, Wifi interface will be used only for internet through router and ethernet interface will be used to connect to a device directly . So, probably, I dont need to configure gateway address fır ethernet interface, right? – Şansal Birbaş Oct 20 '16 at 11:11
  • Yes, I'd eliminate the gateway on the dedicated device connection (see this [superuser SE question](http://superuser.com/a/641668). It may be a good idea to use separate network ranges for the 2 interfaces also (for instance, use 192.168.2.x for the device only network). I don't know what problems could occur if you have two physically separate networks using the same address space as your question suggests (192.168.1). It may not matter, but from an ease of troubleshooting perspective you may want to do it anyway. – thephez Oct 20 '16 at 12:09
  • Did you try adding **static domain_name_servers=** ? – nageswar rao Dec 22 '17 at 11:27

3 Answers3

2

Wireless routers may not accept clients with self-assigned static IPs. When a new client logs in to the router, he gets assigned a dynamic IP address which he is supposed to request via DHCP. If he doesn't, an simply picks a random IP address (as 192.168.1.114 in your case), the router will simply drop its packets.

This can be changed by configuring static IPs on the router: you have to tell it that a client with a particular MAC address will be using a particular IP address. With some routers, the client still have to use DHCP (even if the IP address he will get is always the same) to be able to communicate with the router.

The procedure to configure static IP is router specific. It can easily be found by googling "static IP address" plus the router name.

Dmitry Grigoryev
  • 26,688
  • 4
  • 44
  • 133
  • Are you referring to commercial/industrial wireless routers? I haven't typically had that issue with home models. – thephez Oct 18 '16 at 15:23
  • @thephez Would you refer to ISP-provided routers as commercial? Then yes. Anyway, the wast majority of routers can be configured to provide static IP via DHCP, which I recommend to use. – Dmitry Grigoryev Oct 18 '16 at 15:26
  • Good to know. I always disable the ISP WiFi and use my own wireless router. I agree - static via DHCP is the way to go when possible. – thephez Oct 18 '16 at 15:32
  • I haven't encountered any wireless router that does that. Any examples? – Aloha Oct 19 '16 at 01:22
  • Personally, I have both an old Linksys E1000 and a D-Link DIR655 that support this. – thephez Oct 19 '16 at 11:55
  • Some Wireless routers perfectly accept devices that use self-assigned addresses. There is no reason they shouldn't, unless they have per-MAC security in place which only gets opened after some authentication process. But in general, Dmitry's claim won't hold true. – TheDiveO Jun 07 '17 at 15:38
  • @TheDiveO You're right, I never should have put that *generally* word in there. I'll edit it out. However, something is going on with the OP's router, since he's getting no connection, and that might be the cause. – Dmitry Grigoryev Jun 07 '17 at 15:45
  • There are much deeper pitfalls hidden when connecting two IP interfaces of an IP node to the same subnet, where one root cause is in the way IP stacks are free to choose source IP addresses and outgoing interfaces based on IP destination addresses. Most of the time, such a dual attachment as the OP wants won't work out as intended; there are good reasons for layer 2 redundancy mechanisms. However, when both links are correctly up, then OP should not experience problems, unless there is some black box in her/his network, such as some features of a home router... – TheDiveO Jun 07 '17 at 15:55
0

A couple potential issues:

  1. As @Milliways mentioned, it appears that the same IP Address (192.168.1.115) is being assigned to both network interfaces
  2. Additionally, the domain name server listed is the same as the gateway (192.168.1.1). This is fine as long as that device actually does DNS or forwards it on to an external DNS.

If it's a DNS issue, you should still be able to ping an external IP (try the 8.8.8.8 Google DNS address) once you eliminate the duplicate IPs.

For troubleshooting purposes, I'd recommend focusing on getting just one of the interfaces working and go from there.

thephez
  • 310
  • 1
  • 8
  • Actually, I tried your suggestions. But seems nothing has changed. – Şansal Birbaş Oct 18 '16 at 14:39
  • Can you access the internet if you disconnect one of the interfaces and switch back to DHCP? – thephez Oct 18 '16 at 15:01
  • A yes, I disconnected ethernet and I am able to surf the web with wifi now @thephez – Şansal Birbaş Oct 18 '16 at 15:03
  • If you run `ifconfig`, does the network info fall into the same range as the static values you are trying to use? – thephez Oct 18 '16 at 15:16
  • 1
    Also, if your router supports it, DHCP reservation is an easy way to assign a "static" address without having to configure any static settings on your device. It just associates a MAC address with the same IP address every time, so you can leave DHCP enabled. This is how I normally do it if I want an unchanging IP. – thephez Oct 18 '16 at 15:18
  • ifconfig gives the static ips i assigned to interfaces – Şansal Birbaş Oct 18 '16 at 15:21
  • Oh, sorry. I meant run ifconfig when it is working (connected via DHCP). Just to make sure the static address you're assigning is on the same network as your router. I think this is what @vaha was trying to determine also. Until you can ping the IP of your router, your web browser isn't going to work. – thephez Oct 18 '16 at 15:29
  • Ok but, now I dont use DHCP . I just disconnected ethernet. And after that, wifi connects to internet. – Şansal Birbaş Oct 18 '16 at 15:31
  • But as it is in this case, If I want to use ethernet interface for connecting raspberry to another device and wifi interface for connecting to internet , It will not work. – Şansal Birbaş Oct 18 '16 at 15:37
  • "Normal home networks generally rely on an external DNS from your ISP" is NOT generally true. It is common for ISP to provide a DNS (their own or external), this is NOT configured into client networks - the router gateway forwards DNS. Practices vary by ISP and country, you should not claim your setting is "normal". – Milliways Oct 18 '16 at 22:32
0

This sounds like you don't have assigned DNS server addresses in your static (or fallback) dhcpcd.conf. As your configuration currently is, you only set up a correct IP/netmask and default gateway. This allows for IPv4 connectivity. But most browsers honor the system-assigned DNS service/server addresses, without any fallback. So in your case you don't have told your RPi which DNS server to use. For a quick check, try dig raspberrypi.org, which should give you an error, but also tell you which DNS server it wants to use. For cross-checking, check your /etc/resolv.conf which should lack any DNS server address assignments.

TheDiveO
  • 1,551
  • 1
  • 9
  • 15