eolas/zk/Configuring_internet_connection_on_Debian.md

1.8 KiB

tags
networks
internet
Debian
linux
Ethernet

Ethernet

First identify the name of your Ethernet interface with ip addr show. Example output:

 enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 40:b0:34:37:40:40 brd ff:ff:ff:ff:ff:ff
    inet 192.168.178.53/24 brd 192.168.178.255 scope global enp1s0

That last line is configured via /etc/network/interfaces. If you have not set this up, the top line will say DOWN instead of UP and you will not have internet access over Ethernet.

The follwing example of /etc/network/interfaces is a common default:

auto enp1s0
iface enp1s0 inet static
    address 192.168.178.49
    netmask 255.255.255.0
    gateway 192.168.178.1
    dns-nameservers 8.8.8.8 8.8.4.4

Sets the following:

  • connect automatically as soon as Ethernet port activated
  • use the enp1s0 interface and insist on static IP from DHCP
  • use the static IP address 192.168.178.49
  • use standard subnet masking
  • use Google as the preferred and fallback DNS

Restart networking:

sudo systemctl restart networking

Confirm connection again with ip addr show or sudo systemctl status networking.

Turn the Ethernet interface on/off

ifup enp1s0
ifdown enp1s0

Use dynamic local IP address

If you don't want to use a static IP, the contents of /etc/network/interfaces is more minimal:

auto enp1s0
iface enp1s0 inet dhcp

Basically you just let DHCP do the work of negotiating the IP address from the router.

Contrast with other Linux operating systems

Arch uses systemd-resolvd and NetworkManager. You won't find etc/network/interfaces.

To check network status on Arch use:

systemctl status NetworkManager