Hi,
I am using Linux-krogoth over IMX6
I want the ethernet interface 'eth0' to have static ip address
for that i edit the file
vi /etc/network/interfaces
# The primary network interface auto eth0 iface eth0 inet static address 0.0.0.0 netmask 255.255.255.0
i changed dhcp to static
I added
ifconfig eth0 0.0.0.0
to the startup script of linux (rc.local)
still i am getting a dhcp address at eth0 interface
if there is no dhcp server available in network i get
169.254.x.x ip address
if dhcp server is available ,it gets an dhcp ip address
What might be the issue , do i need to change in any other file to keep eth0 interface ip as static ??
Please resolve
Regards
Sameer
Hi Sameer
one can try kernel boot parameter ip=static_ip_address
as described in Table 11. Common kernel boot parameters attached
Release Notes.
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
This is a reply in case a user get into this thread using the search.
Network configuration can be done through systemd.
To stop using DHCP and define a static ip address:
1. Create a configuration file with desired parameters under /lib/systemd/network
# cat >> /lib/systemd/network/10-eth0.network << EOF
[Match]
Name=eth0
[Network]
Address=10.0.0.100/24
Gateway=10.0.0.1
EOF
2. Restart systemd-networkd service
# systemctl restart systemd-networkd.service
3. Verify
# ifconfig
eth0 Link encap:Ethernet HWaddr 00:04:9f:04:a7:48
inet addr:10.0.0.100 Bcast:10.0.0.255 Mask:255.255.255.0
inet6 addr: fe80::204:9fff:fe04:a748/64 Scope:Link
UP BROADCAST RUNNING MULTICAST DYNAMIC MTU:1500 Metric:1
RX packets:2036376 errors:0 dropped:0 overruns:0 frame:0
TX packets:121193 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:230628591 (219.9 MiB) TX bytes:20226696 (19.2 MiB)
If this reply was useful for you, please mark it as "Correct answer" to help other users accessing it easily.
Regards
Maro