0

First of all, i am sorry i don't know much about networking and i am beginner in linux networking. Please help me with my problem.

I have a Rpi3 and i am configured it as ethernet router from eth0 to eth1 interfaces. I have used USB to Ethernet converter for the eth1 interface. The output of ifconfig is shown below. ethernet router

I have configured Rpi3 as hotspot and observed the ifconfig and it shown below. wifi

For ethernet router, eth1 is not assigned with static IP until a device is connected to the eth1 port but for wifi hotspot it is assigned with a static IP even if there is no device connected.

What i am doing wrong. How to get a static IP for eth1 port even if no device is connected? Is there any way to assign default inet addr to ethernet ports?

Ethernet router configuration bash script is here

Wifi hotspot configuration bash script is here

0

Inside

sudo vi /etc/network/interfaces

add following

auto eth1

iface eth1 inet static
  address 192.168.2.1
  netmask 255.255.255.0
  network 192.168.2.0
  broadcast 192.168.2.255
  gateway 192.168.2.1

This is one of possible ways of adding static ip to new interface

  • i am using stretch version of raspbian. I already configured it using dhcpcd.conf. Please see my configuration bash script dpaste.de/NaTO#L14 . For configuring it as hotspot, see my hotspot script dpaste.de/E4WW – vishnu m c Oct 17 '17 at 4:55
  • what is the difference in interfaces file and dhcpcd.conf. When i set static ip through dhcpcd.conf, i won't get IP address for eth1 until a device is connected. But now i disabled dhcpcd.conf and use interfaces file for setting static IP and now eth1 assigned with IP address even if no device is connected. What is the reason behind this? – vishnu m c Oct 17 '17 at 6:12
  • Can we achieve the same using dhcpcd.conf file? – vishnu m c Oct 17 '17 at 12:05
  • yes, you can add into dhcp.config very similar records (instead of interfaces) interface eth1 static ip_address=192.168.2.1/24 static routers=192.168.2.1 static domain_name_servers=192.168.2.1 – Tamir Oct 17 '17 at 20:45
  • Please look my script. I am doing the same in the script. But it does not assign IP address until a device is connected to the port. That's my question friend? – vishnu m c Oct 18 '17 at 6:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.