Permanent network settings

8,656

Add the following to the configuration file at /etc/network/interfaces or create a new file in /etc/network/interfaces.d/ called eth1

auto eth1
    iface eth1 inet static
        address 10.10.0.2
        netmask 255.255.255.0
        gateway 10.10.0.100

Debian Wiki - Network configuration is a great place to read and understand how to write network configurations

Share:
8,656

Related videos on Youtube

Sebastian Busek
Author by

Sebastian Busek

Updated on September 18, 2022

Comments

  • Sebastian Busek
    Sebastian Busek over 1 year

    In my (virtual) Ubuntu server I'm using two network interfaces, cmd ls /sys/class/net/ returns

    eth0  eth1  lo
    

    but eth1 isn't enabled at startup and I have to manually setup, usually I'm using commands

    sudo ifconfig eth1 10.10.0.2 netmask 255.255.255.0
    sudo route add default gw 10.10.0.100 eth1
    sudo ifconfig eth1 up
    

    My question is: how can I save configuration for eth1?

    cat /etc/network/interfaces:

    source /etc/network/interfaces.d/*
    
    auto lo
    iface lo inet loopback
    
    auto eth0
    iface eth0 inet dhcp
    iface eth0 inet6 auto
    
    • TheOdd
      TheOdd over 7 years
      If all else fails, you could add a startup script that runs those commands.
    • steeldriver
      steeldriver over 7 years
      Please edit your question to include the contents of the /etc/network/interfaces file