Stretch Network

From embeddedTS Manuals
Revision as of 12:55, 12 April 2018 by Mark (talk | contribs) (Created page with "Debian can automatically set up the networking based on the contents of /etc/network/interfaces. For example, to enable DHCP for eth0 by default on startup: <source lang=bas...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Debian can automatically set up the networking based on the contents of /etc/network/interfaces. For example, to enable DHCP for eth0 by default on startup:

echo "auto eth0
iface eth0 inet dhcp" > /etc/network/interfaces.d/eth0

To set up a static IP:

echo "auto eth0
iface eth0 inet static
    address 192.168.0.50
    netmask 255.255.255.0
    gateway 192.168.0.1" > /etc/network/interfaces.d/eth0
echo "nameserver 1.1.1.1" > /etc/resolv.conf

To make this take effect immediately:

service networking restart

To configure other interfaces, replace eth0 with your other network device. New distributions will use predictable interface names. For example, on older Linux a second ethernet port might be eth1, but may now be enp1s0 for pcie, or "enx00D069C0FFEE" including the MAC address for USB ethernets. Run "ifconfig -a" or "ip a" to get a complete list of interfaces, including the ones that are not configured.