Friday, March 4, 2016

Week 20: Day 053 - Configuring Networking


Hello, today I'm covering network configuration. Since a lot of this stuff overlaps with what I have learned so far with Network+, I will skip some stuff about IP addresses, and go straight to the important stuff.

Quick recap though, IPv4 addresses are what is widely used now, but since there is a shortage of these IPs many are switch to IPv6 addressing to cope with this important issue. Difference between them, IPv4 is 32-bit while IPv6 is 128-bit. DHCP is "Dynamic Host Configuration Protocol", and that distributes IPs in your network on its own, meaning no necessity for static addressing. Network cards in Linux will usually have names like "eth0" or "eth1", and it's ordered based on detection order. Ethernet interfaces begin "en", WLAN interfaces begin with "wl", and WWAN interaces with "ww". The next part of the name represents the adapter "o" is onboard, "s" is hotplug spot, "p" is PCI location, and "x" creates a device name. Finally, the numbers end at a number representing an index, ID, or port.
------------------------------------------------------------------------------------------------------------
Example: eno16777734
------------------------------------------------------------------------------------------------------------

To validate your Network Configuration, there are several commands that can be used with the IP utlity:

- "ip addr"
- "ip route"
- "ip link"

More scientifically in terms of ip addr, to see the current network configuration type, "ip addr show", or "ip a". This will show you the current state, the mac address configuration, and the IPv4 or IPv6 configuration. To see the link state type "ip link show". To validate your routing "ip route show"; you can probably see the trend here, if you want to see it, add the modifier "show".

On another note the command "netstat" will be deprecated, and has been on some Linux distros. The new command for this is "ss" or "ss -lt".

------------------------------------------------------------------------------------------------------------
Exercise: 

1. Open a root shell to your server and type ip addr show. This shows the current network configuration. Note the IPv4 address that is used. Notice the network device names that are used; you need these later in this exercise.

Very messy, but yes.

2. Type ip route show to verify routing configuration.

This shows all the information regarding routes created through your system in relation to the network.

3. If your computer is connected to the Internet, you can now use the ping command to verify the connection to the Internet is working properly. Type ping -c 4 8.8.8.8, for instance, to send four packets to IP address 8.8.8.8. If your Internet connection is up and running, you should get “echo reply” answers.

This will ping the specified DNS server. Fun fact: 8.8.8.8 are Google's servers.

4. Type ip addr add 10.0.0.10/24 dev <yourdevicename>.

This will basically change your IP.

5. Type ip addr show. You’ll see the newly set IP address, in addition to the IP address that was already in use.

Static addressing...

6. Type ifconfig. Notice that you do not see the newly set IP address (and there are no options with the ifconfigcommand that allow you to see it). This is one example why you should not use the ifconfig command anymore.

ifconfig may be deprecated by this soon enough. Sounds ridiculous, but it's true!

7. Type ss -tul. You’ll now see a list of all UDP and TCP ports that are listening on your server.

Very useful command. This will indeed show all ports listening form your system.
------------------------------------------------------------------------------------------------------------

Next up was nmtui and nmcli. Since I've already worked with nmtui, I skimmed over some of the stuff I already knew, but I'm still gonna blog about this. In the case of nmcli, I have not done much with that yet, but nmtui is enough since people like Graham have already posted stuff about nmcli.

Anyways, nmtui is an interesting tool which I've used with my virtual machines. It is used for routing and accepting and distributing DHCP. Here are the important notes:

The nmtui interface consists of three menu options:

- Edit a Connection: Use this option to create new connections or edit existing connections.

- Activate a Connection: Use this to (re)activate a connection.

- Set System Hostname: Use this to set the hostname of your computer.

The option to edit a connection offers almost all features that you might ever need to do while working on network connections. It allows you to do anything you need to be doing on the RHCSA exam. You can use it to add any type of connection. Not just Ethernet connections, but also advanced connection types such as network bridges and teamed network drivers are supported.

When you select the option Edit Connection, you get access to a rich interface that allows you to edit most properties of network connections. After editing the connection, you need to deactivate it and activate it again. This should work automatically, but the fact is it does not. This wraps up my post! Thanks for reading.

Quick Note: "hostname.ctl" is extremely useful, shows you important data about your machine.

No comments:

Post a Comment