Advertisement: Linux VPS from $4/month - contact support for custom offer.
-
Administrator
Rename Linux network interface, set static IP (not DHCP)
I think that this may work to rename Linux network interface, but i am not sure if it will persist on next boot and if it is good idea to do this.
Rename Linux network interface:
nmcli;sudo ip link set enp3s0 down;sudo ip link set enp3s0 name eth0;sudo ip link set eth0 up
The network interface names may change when using dhcpcd with named network interfaces.
$ dmesg | grep 'renamed from eth' might help to find the new interface name
remove old: disable [email protected]e
activate new: enable [email protected]e
src: https://wiki.archlinux.org/index.php/Migrate_installation_to_new_hardware#Reconfigure_n etwork
===========
and following should set static IP to a Linux computer, instead of a random IP assigned by the router using DHCP.
set static IP (replace gwip by your router ip and thisip by the IP within your router's subnet):
gwip=192.168.0.1/24 && thisip=192.168.0.20/24 && nic=$(ip -o -4 route show to default | awk '{print $5}');sudo rm -f /etc/systemd/network/${nic}.network;echo -e "[Match]\nName=${nic}\n\n[Network]\nAddress=$thisip\nGateway=$gwip\nDNS=1.1.1.1\nDNS =8.8.8.8"|sudo tee /etc/systemd/network/${nic}.network >/dev/null;sudo systemctl restart --now systemd-networkd.service
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Protected by : ZB
BLOCK & StopForumSpam
Bookmarks