Debian Buster Network: Difference between revisions

From embeddedTS Manuals
(fix syntax (coloring))
 
(Expand example)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
The network in Debian is configured /etc/network/interfaces.d/.  For complete documentation, see [https://wiki.debian.org/NetworkConfiguration Debian's documentation here]
A file with the name of each network device to be configured is placed in /etc/network/interfaces.d/.  The example below demonstrates configuration and use of the wired Ethernet device 'eth0'. For complete documentation, see [https://wiki.debian.org/NetworkConfiguration Debian's documentation here]


Some common examples are shown below.
Some common examples are shown below.
Line 5: Line 5:
DHCP on eth0:
DHCP on eth0:
<source lang=bash>
<source lang=bash>
tee /etc/network/interfaces.d/eth0 <<EOF >/dev/null
cat > /etc/network/interfaces.d/eth0 <<EOF
auto eth0
auto eth0
allow-hotplug eth0
allow-hotplug eth0
Line 14: Line 14:
Static IP on eth0:
Static IP on eth0:
<source lang=bash>
<source lang=bash>
tee /etc/network/interfaces.d/eth0 <<EOF >/dev/null
cat > /etc/network/interfaces.d/eth0 <<EOF
auto eth0
auto eth0
iface eth0 inet static
iface eth0 inet static
     address 192.0.2.7/24
     address 192.0.2.7/24
     gateway 192.0.2.254
     gateway 192.0.2.254
EOF
</source>
The network can then be brought up with the command:
<source lang=bash>
ifup eth0
</source>
</source>

Latest revision as of 14:09, 13 September 2020

A file with the name of each network device to be configured is placed in /etc/network/interfaces.d/. The example below demonstrates configuration and use of the wired Ethernet device 'eth0'. For complete documentation, see Debian's documentation here

Some common examples are shown below.

DHCP on eth0:

cat > /etc/network/interfaces.d/eth0 <<EOF
auto eth0
allow-hotplug eth0
iface eth0 inet dhcp
EOF

Static IP on eth0:

cat > /etc/network/interfaces.d/eth0 <<EOF
auto eth0
iface eth0 inet static
    address 192.0.2.7/24
    gateway 192.0.2.254
EOF

The network can then be brought up with the command:

ifup eth0