Ubuntu Unleashed 2019 Edition: Covering 18.04, 18.10, 19.04

(singke) #1
matthew@seymour:~$  sudo    ifconfig    eth0    catcat.fakeurl.com  up

ip

In preparing for this edition, ifconfig still worked well on our testing
system, but it was no longer installed by default. It is losing favor as ip sees
more use. This command works with a series of subcommands to perform its
tasks. Many of the common subcommands also have short aliases, which are
also listed here. Note that the IP addresses listed below are examples; the
addresses in your network will likely be different.


The following command allows you to get information about all your network
interfaces:


Click here to view code image
matthew@seymour:~$ sudo ip addr show


To assign an IP address to a specific interface, in this case eth1, use the
following command:


Click here to view code image
matthew@seymour:~$ sudo ip addr add 192.168.2.9 dev eth1


To remove an assigned IP address, use this:


Click here to view code image
matthew@seymour:~$ sudo ip addr del 192.168.2.9 dev eth1


Enable a network interface as shown here:


Click here to view code image
matthew@seymour:~$ sudo ip link set eth1 up


To disable a network interface, use the following:


Click here to view code image
matthew@seymour:~$ sudo ip link set eth1 down


Check the routing table as follows:


Click here to view code image
matthew@seymour:~$ sudo ip route show


To add a static route, do the following:


Click here to view code image
matthew@seymour:~$ sudo ip route add 10.10.30.0/24 via 192.168.50.100
dev eth0

Free download pdf