To configure network interface cards (NICs) on a Debian Linux system, you can use the ifconfig
and ip
commands.
ifconfig
command:ifconfig
This will show you the name, IP address, and netmask of each configured NIC.
ifconfig
command with the following syntax:ifconfig INTERFACE_NAME IP_ADDRESS NETMASK
For example, to assign the IP address 192.168.1.10
and the netmask 255.255.255.0
to the eth0
interface, you would run:
ifconfig eth0 192.168.1.10 netmask 255.255.255.0
ip
command to configure the IP address and netmask of a NIC. The syntax is similar to ifconfig
, but you need to use the addr
subcommand and specify the add
and dev
options:ip addr add IP_ADDRESS/NETMASK dev INTERFACE_NAME
For example, to assign the IP address 192.168.1.10
and the netmask 255.255.255.0
to the eth0
interface using the ip
command, you would run:
ip addr add 192.168.1.10/24 dev eth0
ifconfig
or ip
command with the up
option:ifconfig INTERFACE_NAME up
ip link set INTERFACE_NAME up
/etc/network/interfaces
directory.For example, to set the IP address and netmask of the eth0
interface to 192.168.1.10
and 255.255.255.0
, respectively, you would add the following lines to the /etc/network/interfaces
file:
auto eth0 iface eth0 inet static address 192.168.1.10 netmask 255.255.255.0