networks
network configuration
using ip
$ ip ausing ifconfig
$ ifconfigusing nmcli (networkmanager)
$ nmcli device show
Enable/disable interfaces
using ifdown e ifup #
ifdown eth0 && ifup eth0using ip
# ip link set dev eth0 down && ip link set dev eth0 upusing networking (deprecated)
# service networking restartusing network restart
# /etc/init.d/network restartusing ifconfig
# ifconfig eth0 down && ifconfig eth0 up
Setting persistent configuration
sample ‌
/etc/network/interfacesconfiguration
network 191.36.8.32
address 191.36.8.36
gateway 191.36.8.62
broadcast 191.36.8.63
netmask 255.255.255.224
dns-nameservers 191.36.8.2
dns-nameservers 191.36.8.3after changing, restart the interface (e.g.
auto eth0 iface eth0 inet static)
scan devices
using nmap
$ sudo nmap -sn 192.168.0.0/24
using ip command
show all interfaces configuration
$ ip aadd an ip to an interface (not persistent)
$ ip a add 192.168.0.1/24 dev eth0Remove an ip from an interface
$ ip a del 192.168.0.1/24 dev eth0deactivate an interface
$ ip link set dev eth0 downactivate an interface
$ ip link set dev eth0 upmodifying a MAC address of an interface (interface must be deactivated)
$ ip link set dev eth0 address 00:0c:13:45:5b:b6add default route (default may be replaced by 0/0)
$ ip route add default via 192.168.0.254add a static route to a subnetwork
$ ip route add 10.0.0.0/24 via 192.168.0.254 dev eth0
useful tools
ip calculator
# ipcalc 191.36.8.36/27
Last updated
Was this helpful?