Score:0

Restart network interface after reconfiguration of default gateway

cn flag

I had to swap out my router, and unfortunately that also means changing the default gateway.

I have updated the configuration in /etc/netplan/00-installer-config.yml with my net configuration and run # ip link set eno1 down && ip link set eno1 up, which corresponds with my network adapter:

2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 68:1d:ef:29:94:99 brd ff:ff:ff:ff:ff:ff
    altname enp1s0
    inet 10.18.10.242/24 brd 10.18.10.255 scope global eno1
       valid_lft forever preferred_lft forever
    inet6 fe80::6a1d:efff:fe29:9499/64 scope link
       valid_lft forever preferred_lft forever

I expected this to work, since executing # ifdown eth0 && ifup eth0 worked on my debian box after updating /etc/network/interfaces. I could ping 1.1.1.1 with success.

I have tried all of the following (after executing sudo -i) with a "No such file or directory", "Command 'XXXX' not found, but can be installed with: ..." or similar error:

  • /etc/init.d/network restart
  • systemctl restart network
  • systemctl restart NetworkManager
  • nmcli networking off && nmcli networking on
  • service network-manager restart
  • systemctl restart NetworkManager.service

What can I do besides restarting the box (which I do not want to do, if possible)

I know I can apt install ifupdownor apt install ifupdow-ng but I assume that the reason for not having these installed per default is that there is a newer, smarter way to do this, which eludes me.

Score:1
id flag

Try just renewing the DHCP IP address instead of downing the card and bringing it back up.

sudo dhclient -r -v eno1 && sudo dhclient -v eno1

But, if you are to down the NIC and bring it back up make sure that you are using sudo with your command to elevate it

sudo ip link set eno1 down && sudo ip link set eno1 up

But, when I just tested that command, I still had to release and renew my IP address for it to come back up correctly.

cn flag
as I wrote - I was in an escalated prompt (`sudo-i`) but running `ip link set eno1 down && ip link set eno1 up` apparently worked this time
Terrance avatar
id flag
@JonasStumphStevnsvig "I have tried all of the following (after executing sudo -i)" is listed after the command in your question so I assumed that you only used it on the rest listed but not the first command. One issue with that command `sudo -i` is that it switches to root and may change the path and that is why you were getting command not found. I always recommend that you use `sudo command` that way the path is always the same. But that is now moot since you did solve your issue. Glad it is working for you!
cn flag
I could have written "I have run all these with root privileges" which could indicate any of three methods. I am getting the command not found because many of the packages are not installed out of the box...
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.