Just about everything I am going to talk about here, could be done from the Xwindows GUI.
If you're a desktop user with a local GUI that's great. But for anyone who works in an enterprise environment, or
with Cloud based VMs you likely will not have a GUI. Just about all your work will be done via SSH and the command line.
This isn't just handy for big data centers with hundreds or thousands of systems, this can even be handy for
3 or 4 local computers at your house. It's not always easy or convenient to get up and walk over to another computer
just so you can use the mouse and Xwindows.
In the "old" days we used something called networkd. Typically we edited ifcfg-eth0 files and used ifup and ifdown
to start up and shutdown interfaces. That's the way it was for a couple of decades.
But now, virtually all modern Linux distro's use something called NetworkManager. It can take a little getting used to.
Just about every command here starts with "nmcli" ( NetworkManger command line interface )
To see what interfaces that NetworkManager knows about, you can type
nmcli connection show
or if you're lazy like me, this can be shorted to... nmcli con sho
You should see an output similar to this....
nmcli connection show
NAME UUID TYPE DEVICE
enp6s0 589c0a0b-4881-4b70-af9f-c372814c939d ethernet enp6s0
enp4s0f0 ae11891b-4f4e-4ef4-ac6b-f6c3a9a51f25 ethernet enp4s0f0
lo 60bd2b8d-5354-4e54-aaee-9c311073949c loopback lo
Now sometimes, some distro's, depending on how they get installed, name the connections something like...
'Wired Connection 1' but at least the 'DEVICE' column will usually show you which device that is.
In my case above, I have two ethernet connections that I'm using. I usually use this command along with the
ip addr ..and.. ip route commands. In my case ip ad gives me this output.
ip ad
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: enp6s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 70:85:c2:f4:33:15 brd ff:ff:ff:ff:ff:ff
inet 10.0.0.127/24 brd 10.0.0.255 scope global dynamic noprefixroute enp6s0
valid_lft 148489sec preferred_lft 148489sec
inet6 2601:1c1:4000:5fd0::59ef/128 scope global dynamic noprefixroute
valid_lft 196338sec preferred_lft 196338sec
inet6 2601:1c1:4000:5fd0:85a:de7d:b579:2c9f/64 scope global dynamic noprefixroute
valid_lft 301sec preferred_lft 301sec
inet6 fe80::4215:1bf5:cbc9:8823/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: enp4s0f0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
link/ether 00:26:55:ea:b9:aa brd ff:ff:ff:ff:ff:ff
inet 10.10.16.25/24 brd 10.10.16.255 scope global noprefixroute enp4s0f0
valid_lft forever preferred_lft forever
inet6 fe80::f7fa:bdfa:c87c:49f9/64 scope link tentative noprefixroute
valid_lft forever preferred_lft forever
4: enp4s0f1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
link/ether 00:26:55:ea:b9:ab brd ff:ff:ff:ff:ff:ff
5: wlp5s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 9a:b1:05:c2:17:c1 brd ff:ff:ff:ff:ff:ff permaddr 50:e0:85:f4:47:d2
I have 5 interfaces here. Everyone will always have a "lo" interface. That's called your loopback interface. It will always have an IP
address on 127.0.0.1, you should NEVER change this, it can break things. Almost every application you have that points to
"localhost" uses that IP address to communicate with your computer. If you were to run this command for example...
ping localhost
You would effectively being the same thing as ...
ping 127.0.0.1
But the main thing I want you to notcei here, is that even though I have five interfaces, only three of them show up
in my nmcli con show command, why is that? It's because I haven't configured those other connections yet.
Normally you will only see the interface that got setup automatically when you installed Linux, and your "lo" interface.
The entire 127.0.0.X subnet is reserved ONLY for loop back, so even if you put another IP address on another interface
in this same subnet. It probably will not work as intended.
While we are on that subject. There are a couple of subnets we should mention here.
192.168.X.X, and 10.X.X.X these subnets are not routeable out to the internet. Virtually all routers, and ISP's
will block any internet traffic outside your house/business from getting out to the internet.
But you might be thinking, I have a 192.168.1.X address on my computer and I get out to the internet no problem.
Well not really, your ISP is using something called NAT. ( Network Address Translation ) and your computers IP address
get "changed" before it goes out to the internet. To test this, you can go here.... https://whatismyipaddress.com/
.. and that will show what the IP address that you use out on the internet really is. However you don't really have any
control over it, your Internet Service Provider controls that. ( Xfinity, Comcast, Spectrum, etc... )
So really most of the time, the best subnets to use inside your house of business, are the 192.168.X.X and 10.X.X.X
subnets.
If you're a desktop user with a local GUI that's great. But for anyone who works in an enterprise environment, or
with Cloud based VMs you likely will not have a GUI. Just about all your work will be done via SSH and the command line.
This isn't just handy for big data centers with hundreds or thousands of systems, this can even be handy for
3 or 4 local computers at your house. It's not always easy or convenient to get up and walk over to another computer
just so you can use the mouse and Xwindows.
In the "old" days we used something called networkd. Typically we edited ifcfg-eth0 files and used ifup and ifdown
to start up and shutdown interfaces. That's the way it was for a couple of decades.
But now, virtually all modern Linux distro's use something called NetworkManager. It can take a little getting used to.
Just about every command here starts with "nmcli" ( NetworkManger command line interface )
To see what interfaces that NetworkManager knows about, you can type
nmcli connection show
or if you're lazy like me, this can be shorted to... nmcli con sho
You should see an output similar to this....
nmcli connection show
NAME UUID TYPE DEVICE
enp6s0 589c0a0b-4881-4b70-af9f-c372814c939d ethernet enp6s0
enp4s0f0 ae11891b-4f4e-4ef4-ac6b-f6c3a9a51f25 ethernet enp4s0f0
lo 60bd2b8d-5354-4e54-aaee-9c311073949c loopback lo
Now sometimes, some distro's, depending on how they get installed, name the connections something like...
'Wired Connection 1' but at least the 'DEVICE' column will usually show you which device that is.
In my case above, I have two ethernet connections that I'm using. I usually use this command along with the
ip addr ..and.. ip route commands. In my case ip ad gives me this output.
ip ad
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: enp6s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 70:85:c2:f4:33:15 brd ff:ff:ff:ff:ff:ff
inet 10.0.0.127/24 brd 10.0.0.255 scope global dynamic noprefixroute enp6s0
valid_lft 148489sec preferred_lft 148489sec
inet6 2601:1c1:4000:5fd0::59ef/128 scope global dynamic noprefixroute
valid_lft 196338sec preferred_lft 196338sec
inet6 2601:1c1:4000:5fd0:85a:de7d:b579:2c9f/64 scope global dynamic noprefixroute
valid_lft 301sec preferred_lft 301sec
inet6 fe80::4215:1bf5:cbc9:8823/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: enp4s0f0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
link/ether 00:26:55:ea:b9:aa brd ff:ff:ff:ff:ff:ff
inet 10.10.16.25/24 brd 10.10.16.255 scope global noprefixroute enp4s0f0
valid_lft forever preferred_lft forever
inet6 fe80::f7fa:bdfa:c87c:49f9/64 scope link tentative noprefixroute
valid_lft forever preferred_lft forever
4: enp4s0f1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
link/ether 00:26:55:ea:b9:ab brd ff:ff:ff:ff:ff:ff
5: wlp5s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 9a:b1:05:c2:17:c1 brd ff:ff:ff:ff:ff:ff permaddr 50:e0:85:f4:47:d2
I have 5 interfaces here. Everyone will always have a "lo" interface. That's called your loopback interface. It will always have an IP
address on 127.0.0.1, you should NEVER change this, it can break things. Almost every application you have that points to
"localhost" uses that IP address to communicate with your computer. If you were to run this command for example...
ping localhost
You would effectively being the same thing as ...
ping 127.0.0.1
But the main thing I want you to notcei here, is that even though I have five interfaces, only three of them show up
in my nmcli con show command, why is that? It's because I haven't configured those other connections yet.
Normally you will only see the interface that got setup automatically when you installed Linux, and your "lo" interface.
The entire 127.0.0.X subnet is reserved ONLY for loop back, so even if you put another IP address on another interface
in this same subnet. It probably will not work as intended.
While we are on that subject. There are a couple of subnets we should mention here.
192.168.X.X, and 10.X.X.X these subnets are not routeable out to the internet. Virtually all routers, and ISP's
will block any internet traffic outside your house/business from getting out to the internet.
But you might be thinking, I have a 192.168.1.X address on my computer and I get out to the internet no problem.
Well not really, your ISP is using something called NAT. ( Network Address Translation ) and your computers IP address
get "changed" before it goes out to the internet. To test this, you can go here.... https://whatismyipaddress.com/
.. and that will show what the IP address that you use out on the internet really is. However you don't really have any
control over it, your Internet Service Provider controls that. ( Xfinity, Comcast, Spectrum, etc... )
So really most of the time, the best subnets to use inside your house of business, are the 192.168.X.X and 10.X.X.X
subnets.