Mostrando entradas con la etiqueta net-config. Mostrar todas las entradas
Mostrando entradas con la etiqueta net-config. Mostrar todas las entradas

sábado, 6 de mayo de 2023

Basic network configuration ip command

 

Layer 3: Configuration

Use one of the following commands to manually set a network (Layer 3) address:
# ip addr add 10.0.2.25/255.255.255.0 dev eth0

Use one of the following commands to manually set or change the default route:
# ip route add default via 10.0.2.2
# route add default gw 10.0.2.2

To add the address of a DNS server, use the following command:
$ echo "nameserver 4.2.2.1" >> /etc/resolv.conf

To manually request a DHCP configuration, use the dhclient command:
# dhclient eth0

martes, 21 de marzo de 2023

Using ip: Examples

 

The ip utility can be used in many ways. A few example commands and their applications are provided below.

Show information for all network interfaces:

$ ip link show

Show information for the eth0 network interface, including statistics:

$ ip -s link show eth0

Set the IP address for eth0:

$ sudo ip addr add 192.168.1.7 dev eth0

Bring interface eth0 down:

$ sudo ip link set eth0 down

Set MTU to 1480 bytes for interface eth0:

$ sudo ip link set eth0 mtu 1480

Set route to network:

$ sudo ip route add 172.16.1.0/24 via 192.168.1.5