Debian Linux Configure Network Interface Cards - IP address and Netmasks

Debian Linux Configure Network Interface Cards - IP address and Netmasks

To configure network interface cards (NICs) on a Debian Linux system, you can use the ifconfig and ip commands.

  1. To view the current configuration of your NICs, use the ifconfig command:
refer‮ual:ot ‬tturi.com
ifconfig

This will show you the name, IP address, and netmask of each configured NIC.

  1. To assign a static IP address and netmask to a NIC, use the 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
  1. Alternatively, you can use the 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
  1. To apply the changes and bring the interface up, use the ifconfig or ip command with the up option:
ifconfig INTERFACE_NAME up
ip link set INTERFACE_NAME up
  1. To make the changes permanent, you will need to edit the configuration files for the network interfaces. On Debian systems, these files are located in the /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
Created Time:2017-10-28 14:02:24  Author:lautturi