Posted in Linux, network

Network Configuration in RHEL 7/Centos 7

In this post I am going to show how to do network configuration in rhel7/centos7. We have ip command introduced in linux way back but we never used it. In this post we will use ip related commands which isnot easy to use as it has many options need to provide to get relevant output.

to see IP address details normally we used ifconfig command we check the same using ip addr show command.

1

Here we an see ipv4 address of eth0 interface along with ipv6 address and network UP status and mtu size.

we can check routing information using ip route command.

2

here default route is 192.168.122.1 for device eth0.

We can even check the network throughput from any network interface. Network performance can be checked using ip -s link command.

3

Here transfer bytes and received bytes are showing and it also shows errors dropped packets.

We can do troubleshooting of port and service using netstat or ss commands.

4

in this output we can see all listening tcp/udp running services and its related port numbers.

-t — show tcp sockets

-u — show udp sockets

-l — show only listening sockets

-p — show process names using that sockets

-e — show extended information like user and inode number of sockets

-n — show number instead of names.

We can add IP address using ip addr command.

5

we can add route as well using ip route add

6

BUT changes made through ip commands will not survive after reboot of NetworkManager or server.

We use nmcli command to make changes permanently or we can edit configuration file directly from /etc/sysconfi/network-scripts location to make network modification permanent.

in nimcli we have concept of connection. A connection is configuration used for a device which is made up of collection of setting.

To see existing connections on server use nmcli con show

7

We can check status of device where it connected or not.

8

Now we will add one connection dhcp_test which will autoconnect as ethernet connection

9

now we will add one more connection static_test which will not autoconnect and we need to specify IP and gateway address.

10-1

“–” shows connection dhcp_test and static_test is not active presently.

We can activate static connection now using nmcli con up

11

12

At any time only one connection will be active on Ethernet interface.

We can modify connection properties using nmcli con mod . Following are connection properties for static_test.

14

Here connection.autoconnect is set to no. We want to make this connection to autoconnect to yes.

15

You can delete any connection created using nmcli con del

16

We can perform these addition and modification of network configuration using nmtui text user interface tool as well.

13

Good Luck for Networking in RHEL7.

Advertisements

Author:

I have created this blog to share my learning from IT world. Hope you find it useful in your day to day work. Feel free to send me your feedback about my blog.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s