2.3 KiB
2.3 KiB
Configurare IP address Debian 12
Verificare quale è il nome della rete
ip a
dalla risposta si evince che la rete è enP3p49s0
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host noprefixroute
valid_lft forever preferred_lft forever
2: enP3p49s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether c0:74:2b:fc:61:b7 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.4/24 brd 192.168.1.255 scope global dynamic noprefixroute enP3p49s0
valid_lft 32132sec preferred_lft 32132sec
inet6 fe80::70da:ae13:b91c:cf72/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: enP4p65s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether c0:74:2b:fc:61:b6 brd ff:ff:ff:ff:ff:ff
editando il file /etc/network/interfaces
sudo nano /etc/network/interfaces
va scritto come
auto <interface_name>
iface <interface_name> inet static
address <your_static_ip>/<subnet_mask_bits>
gateway <your_gateway_ip>
dns-nameservers <your_dns_server(s)>
con i seguenti campi
<interface_name> is the name of your network interface.
<your_static_ip> is the desired static IP address.
<subnet_mask_bits> is the subnet mask represented as bits (e.g., /24 for 255.255.255.0).
<your_gateway_ip> is the IP address of your gateway router.
<your_dns_server(s)> are the IP addresses of your DNS servers, separated by spaces.
quindi nel nostro caso va aggiunto (qui ho usato dns di google)
auto enP3p49s0
iface enP3p49s0 inet static
address 192.168.1.4/24
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4
Applying Network Configuration Changes
After editing your network configuration files, apply the changes using the ifup and ifdown commands. These commands deactivate and reactivate your network interface, respectively.
sudo ifdown enP3p49s0 && sudo ifup enP3p49s0
For the new network settings to take effect, you may also restart the networking service entirely.
sudo systemctl restart networking