First principles: Difference between revisions

From Mike's wiki
Jump to navigation Jump to search
(Created page with "=== Using ifconfig === $ ifconfig eth0:1 10.10.20.218 netmask 255.255.255.0 broadcast 10.10.20.255 === Using ip === $ ip a add 192.168.178.2/24 dev eth0")
 
No edit summary
Line 1: Line 1:
=== Using ifconfig ===
== Using ifconfig ==
 
=== Show interface configuration ===
<pre>
$ ifconfig eno1
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.79  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::a6a5:87ad:cb7a:6cad  prefixlen 64  scopeid 0x20<link>
        ether 50:eb:f6:3f:27:61  txqueuelen 1000  (Ethernet)
        RX packets 137223  bytes 104941638 (104.9 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 91146  bytes 22484489 (22.4 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 16  memory 0xa1400000-a1420000 
</pre>
 
Show All interfaces
<pre>
$ ifconfig
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.2.1  netmask 255.255.255.0  broadcast 192.168.2.255
        ether 92:51:fc:1b:36:38  txqueuelen 1000  (Ethernet)
        RX packets 277  bytes 28650 (28.6 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 899  bytes 129148 (129.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
 
br-b737ea16f9fc: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.25.0.1  netmask 255.255.0.0  broadcast 172.25.255.255
        ether 02:42:79:64:bc:e2  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
 
docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        ether 02:42:db:62:09:42  txqueuelen 0  (Ethernet)
.....
</pre>
 
=== Add ip alias ===
$ ifconfig eth0:1 10.10.20.218 netmask 255.255.255.0  broadcast 10.10.20.255
$ ifconfig eth0:1 10.10.20.218 netmask 255.255.255.0  broadcast 10.10.20.255


=== Using ip ===
== Using ip ==
 
=== add ip alias ===
$ ip a add 192.168.178.2/24 dev eth0
$ ip a add 192.168.178.2/24 dev eth0

Revision as of 12:13, 15 January 2023

Using ifconfig

Show interface configuration

$ ifconfig eno1
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.79  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::a6a5:87ad:cb7a:6cad  prefixlen 64  scopeid 0x20<link>
        ether 50:eb:f6:3f:27:61  txqueuelen 1000  (Ethernet)
        RX packets 137223  bytes 104941638 (104.9 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 91146  bytes 22484489 (22.4 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 16  memory 0xa1400000-a1420000  

Show All interfaces

$ ifconfig
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.2.1  netmask 255.255.255.0  broadcast 192.168.2.255
        ether 92:51:fc:1b:36:38  txqueuelen 1000  (Ethernet)
        RX packets 277  bytes 28650 (28.6 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 899  bytes 129148 (129.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

br-b737ea16f9fc: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.25.0.1  netmask 255.255.0.0  broadcast 172.25.255.255
        ether 02:42:79:64:bc:e2  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        ether 02:42:db:62:09:42  txqueuelen 0  (Ethernet)
.....

Add ip alias

$ ifconfig eth0:1 10.10.20.218 netmask 255.255.255.0 broadcast 10.10.20.255

Using ip

add ip alias

$ ip a add 192.168.178.2/24 dev eth0