Problem in assigning static IP address to ethernet port in Raspberry Pi?
I am having Rpi3 which uses debian stretch version of OS. In this version, the network interfaces can assign static IP using two methods.
1. First is by editing dhcpcd.conf interface eth1 static ip_address=192.168.42.1/24 static routers=192.168.42.1 static domain_name_servers=192.168.42.1 2. Second is by editing /etc/network/interfaces file and disable the dhcpcd. auto eth0 iface eth0 inet dhcp allow-hotplug eth1 iface eth1 inet static address 192.168.42.1 netmask 255.255.255.0 network 192.168.42.0 broadcast 192.168.42.255 But doing it by first method, ifconfig command shows eth1 port is not assigned with static IP until a device is connected through the port. But by second method, ifconfig command shows eth1 port assigned with static IP even if there is no connected device. What is the actual difference in between them? I am new to linux networking and i hope you help me? |
|
Quote:
But this problem is not present in the second method. In the second method, i have already disabled the dhcpcd by sudo systemctl disable dhcpcd. Static IP is assigned to eth1 port even if i haven't connected my laptop. |
The DHCP client checks for a link status but networking startup does not.
As stated the second method eth1 is assigned an IP address regardless if connected to anything. |
Quote:
|
Using the nolink option might work but it seems illogical to want to use the dhcp client to set a static IP address instead of the interfaces file.
|
Quote:
Quote:
If i am wrong please let me know |
I don't know yet. I have not tried running Stretch but would of expected it to be similar to previous versions.
|
:-( :-(
|
All times are GMT -5. The time now is 05:21 PM. |