Score:1

Network interface down after every reboot

co flag

I have installed Ubuntu server 22.04 for the first time and am still pretty new to linux. Every time I reboot the server I will have to run the command sudo ifconfig enp6s0f1 upto get that interface up and running. (I have learned after reading through forums that I should start using ip commands) I have edited my netplan .yaml file and will include it. I have my main interface which doesn't have this issue and a phone tethered to the server that I also do not have this issue with. I've read around and still can't seem to find the solution to my problem. Any advice is greatly appreciated and thank you for your time.

 network:
    version: 2
    renderer: networkd
    ethernets:
        enp0s25:
         dhcp4: true
        enp6s0fl:
         dhcp4: false
        usb0:
         dhcp4: false
Score:0
tf flag

You can try this:

  1. Create systemd unit file:

    sudo nano /etc/systemd/system/manual-iface.service
    

Then add following lines in the file and save it using Ctrl+o and exit using Ctrl+x:

[Unit]
Description=Service to bring up/down unconfigured nic enp6s0f1
After=network.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/sbin/ip link set enp6s0f1 up
ExecStop=/sbin/ip link set enp6s0f1 down

[Install]
WantedBy=multi-user.target
  1. Then enable the service at boot:

    sudo systemctl enable manual-iface.service
    
Artur Meinild avatar
vn flag
Don't you think fixing the `.yaml` file would be a better solution?
Score:0
vn flag

It seems your .yaml file has some errors.

First, if you expect your interface to get an IP-address, dhcp4 should be set to true.

Also, you have the wrong name for your interface - you have written enp6s0fl, where it should be enp6s0f1. (Maybe you should try another font, so you can clearly distinguish l from 1)

Try this fixed .yaml file:

network:
    version: 2
    renderer: networkd
    ethernets:
        enp0s25:
          dhcp4: true
        enp6s0f1:
          dhcp4: true
        usb0:
          dhcp4: false
Witty Tut avatar
co flag
Thank you for spotting this issue!
Score:0
am flag

Probably, I think the ip value changes every time you boot. This problem occurs when setting the BOOTPROTO option to dhcp when using redhat.

The way I recommend is to set up a static IP and use it.

network:
    version: 2
    renderer: networkd
    ethernets:
        enp0s25:
          dhcp4: true
        enp6s0f1:
          dhcp4: false
          addresses: [x.x.x.x/24]  # Insert IP address of machine
          routes:
            - to: default
              via: y.y.y.y         # Insert IP address of gateway
          nameservers:
            addresses: [z.z.z.z]   # Insert IP address of DNS server
        usb0:
          dhcp4: false
Artur Meinild avatar
vn flag
The question was about the interface `enp6s0f1`, not `enp0s25`.
seokhun avatar
am flag
I made a mistake by confusing the two. Entering the information I entered into enp6s0fl seems to solve the problem.
Artur Meinild avatar
vn flag
To not add further confusions, could you please specify the correct name - `enp6s0f1` as I also state in my post.
seokhun avatar
am flag
The post has been modified, and addresses and gateway4 can be entered according to the IP address.
Artur Meinild avatar
vn flag
The `gateway4` property is deprecated. It should be replaced with `routes:`. Also, your indentation was not properly aligned.
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.