Pular para o conteúdo

Administering Oracle Linux 7: Part 2 — Network Management

Administering Oracle Linux 7: Part 2 — Network Management

This article is Part 2 of a series that explains how to administer Oracle Linux 7. This article focuses on how to configure and administer the network configuration in Oracle Linux 7.

Read the Part 1

Read the Part 3

Introduction to Network Management

Oracle Linux 7 has deeply changed its framework for the configuration and management of the network, so for anyone who works and configures common services such as web services, e-mail services, and LDAP services, this article shows the correct step-by-step procedures for how to administer the network.

From previous versions, there are basic commands that are used to monitor and verify the network configuration, and these commands can still be useful while administering and maintaining an Oracle Linux 7 environment. For example, to check the link state and IP address bound to each network interface, execute the following commands:

[root@oel73 ~]# ip link show

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT 

    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000

    link/ether 00:0c:29:c4:c1:47 brd ff:ff:ff:ff:ff:ff

3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT 

    link/ether 52:54:00:fc:40:f7 brd ff:ff:ff:ff:ff:ff

4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN mode DEFAULT qlen 500

    link/ether 52:54:00:fc:40:f7 brd ff:ff:ff:ff:ff:ff

[root@oel73 ~]# ip addr show

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 

    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

    inet 127.0.0.1/8 scope host lo

    inet6 ::1/128 scope host 

       valid_lft forever preferred_lft forever

2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000

    link/ether 00:0c:29:c4:c1:47 brd ff:ff:ff:ff:ff:ff

    inet 192.168.1.112/24 brd 192.168.1.255 scope global ens33

    inet6 fe80::20c:29ff:fec4:c147/64 scope link 

       valid_lft forever preferred_lft forever

3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN 

    link/ether 52:54:00:fc:40:f7 brd ff:ff:ff:ff:ff:ff

    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0

    inet6 fe80::5054:ff:fefc:40f7/64 scope link 

       valid_lft forever preferred_lft forever

4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN qlen 500

    link/ether 52:54:00:fc:40:f7 brd ff:ff:ff:ff:ff:ff

As you can see in the output above, the main interface is ens33 (Oracle Linux 7 is running over VMware Workstation), it is connected to the network, and its IP address is 192.168.1.112. Additionally, the IP route table on the system is shown by running the following command:

[root@oel73 ~]# ip route show

default via 192.168.1.1 dev ens33  proto static  metric 1024 

192.168.1.0/24 dev ens33  proto kernel  scope link  src 192.168.1.112 

192.168.122.0/24 dev virbr0  proto kernel  scope link  src 192.168.122.1

Indeed, there are two routes associated to ens33 network interface and one of them is the default gateway. The next step is to learn how to configure the network interfaces on Oracle Linux 7.

Gathering Information About the Network

Oracle Linux 7 has a very important daemon named Network Manager that monitors and manages all network settings. In the Network Manager context, a network interface is a device and a connection is a configuration used by this device. You can create multiple connections for a device, but only one of them can be active. Moreover, the configuration files from Network Manager are saved in the /etc/sysconfig/network-scripts directory, as shown below:

[root@oel73 ~]# cd /etc/sysconfig/network-scripts/

[root@oel73 network-scripts]# ls -al

-rw-r--r--. 1 root root   298 Apr  4 23:06 ifcfg-Auto_Ethernet-1

-rw-r--r--. 1 root root   254 Apr  2  2014 ifcfg-lo

lrwxrwxrwx. 1 root root    24 Feb 11 01:56 ifdown -> ../../../usr/sbin/ifdown

-rwxr-xr-x. 1 root root   627 Apr  2  2014 ifdown-bnep

-rwxr-xr-x. 1 root root  5553 Apr  2  2014 ifdown-eth

-rwxr-xr-x. 1 root root   781 Apr  2  2014 ifdown-ippp

-rwxr-xr-x. 1 root root  4141 Apr  2  2014 ifdown-ipv6

lrwxrwxrwx. 1 root root    11 Feb 11 01:56 ifdown-isdn -> ifdown-ippp

-rwxr-xr-x. 1 root root  1642 Apr  2  2014 ifdown-post

-rwxr-xr-x. 1 root root  1068 Apr  2  2014 ifdown-ppp

-rwxr-xr-x. 1 root root   837 Apr  2  2014 ifdown-routes

-rwxr-xr-x. 1 root root  1444 Apr  2  2014 ifdown-sit

To verify all connections and the active ones, execute the following commands:

[root@oel73 ~]# nmcli con show

NAME           UUID                                  TYPE             DEVICE     

Auto Ethernet  42cc5b4c-b574-41dc-9d3f-ddd6ec0e38d3  802-3-ethernet   ens33      

virbr0-nic     7d787f69-5536-4a95-8348-6bff621e1b05  generic          virbr0-nic 

virbr0         b70e08f1-1a85-449d-be7c-9a68d5942c63  bridge           virbr0     

[root@oel73 ~]# nmcli con show --active

NAME           UUID                                  TYPE             DEVICE     

Auto Ethernet  42cc5b4c-b574-41dc-9d3f-ddd6ec0e38d3  802-3-ethernet   ens33      

virbr0-nic     7d787f69-5536-4a95-8348-6bff621e1b05  generic          virbr0-nic 

virbr0         b70e08f1-1a85-449d-be7c-9a68d5942c63  bridge           virbr0

To collect further details about a specific connection, execute the following:

[root@oel73 ~]# nmcli con show "Auto Ethernet"

connection.id:                          Auto Ethernet

connection.uuid:                        42cc5b4c-b574-41dc-9d3f-ddd6ec0e38d3

connection.interface-name:              --

connection.type:                        802-3-ethernet

connection.autoconnect:                 yes

connection.timestamp:                   1428200895

connection.read-only:                   no

connection.permissions:                 

connection.zone:                        --

connection.master:                      --

connection.slave-type:                  --

connection.secondaries:                 

connection.gateway-ping-timeout:        0

802-3-ethernet.port:                    --

802-3-ethernet.speed:                   0

802-3-ethernet.duplex:                  --

802-3-ethernet.auto-negotiate:          yes

802-3-ethernet.mac-address:             00:0C:29:C4:C1:47

802-3-ethernet.cloned-mac-address:      --

802-3-ethernet.mac-address-blacklist:   

802-3-ethernet.mtu:                     auto

802-3-ethernet.s390-subchannels:        

...

The Universally Unique Identifier (UUID) of the connection also could be used, as shown below:

[root@oel73 ~]# nmcli con show 42cc5b4c-b574-41dc-9d3f-ddd6ec0e38d3

connection.id:                          Auto Ethernet

connection.uuid:                        42cc5b4c-b574-41dc-9d3f-ddd6ec0e38d3

connection.interface-name:              --

connection.type:                        802-3-ethernet

...

Instead of collecting details about a connection, we could gather essential information about a specific device (ens33) by running the following command:

[root@oel73 ~]# nmcli dev show ens33

GENERAL.DEVICE:                         ens33

GENERAL.TYPE:                           ethernet

GENERAL.HWADDR:                         00:0C:29:C4:C1:47

GENERAL.MTU:                            1500

GENERAL.STATE:                          100 (connected)

GENERAL.CONNECTION:                     Auto Ethernet

GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/ActiveConnection/0

WIRED-PROPERTIES.CARRIER:               on

IP4.ADDRESS[1]:                         ip = 192.168.1.112/24, gw = 192.168.1.1

IP4.DNS[1]:                             192.168.1.1

IP4.DOMAIN[1]:                          example.com

IP6.ADDRESS[1]:                         ip = fe80::20c:29ff:fec4:c147/64, gw = ::

To show the general status of each interface, execute the following:

[root@oel73 ~]# nmcli dev status

DEVICE      TYPE      STATE                                 CONNECTION    

ens33       ethernet  connected                             Auto Ethernet 

virbr0-nic  tap       connected                             virbr0-nic    

virbr0      bridge    connecting (getting IP configuration) virbr0        

lo          loopback  unmanaged                             --

Configuring a Network Interface

The network configuration procedure has changed a lot since Oracle Linux 6. It now can be done in an easy way using either the command line (nmcli tool) or a GUI tool (not discussed in this article).

To configure a network interface, we have to create a connection (for example, myconnection) and associate this new connection to a device (ens33). Furthermore, the IP configuration can be bound through either the DHCP service or a static IP address. In this example, the device (ens33) will be associated with an IP address by using the DHCP service. Thus, to perform both tasks, execute the following commands:

[root@oel73 ~]# nmcli con add con-name "myconnection" type ethernet ifname ens33

Connection 'myconnection' (a4f95890-34b4-457c-bedd-567b9560ec36) successfully added.

[root@oel73 ~]# nmcli con show

NAME           UUID                                  TYPE            DEVICE     

myconnection   a4f95890-34b4-457c-bedd-567b9560ec36  802-3-ethernet  --         

Auto Ethernet  42cc5b4c-b574-41dc-9d3f-ddd6ec0e38d3  802-3-ethernet  ens33      

virbr0-nic     7d787f69-5536-4a95-8348-6bff621e1b05  generic         virbr0-nic 

virbr0         b70e08f1-1a85-449d-be7c-9a68d5942c63  bridge          virbr0

Because the chosen method to configure an IP address was by using DHCP service, the task is finished.  To make myconnection active, execute the following:

[root@oel73 ~]# nmcli con up "myconnection"

Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/3)

[root@oel73 ~]# nmcli con show --active

NAME           UUID                                  TYPE            DEVICE     

myconnection   a4f95890-34b4-457c-bedd-567b9560ec36  802-3-ethernet  ens33      

virbr0-nic     d787f69-5536-4a95-8348-6bff621e1b05   generic         virbr0-nic 

virbr0         b70e08f1-1a85-449d-be7c-9a68d5942c63  bridge          virbr0

To verify the acquired configuration, run the following:

[root@oel73 ~]# nmcli con show myconnection | grep 'DHCP4|IP4'

IP4.ADDRESS[1]:                         ip = 192.168.1.112/24, gw = 192.168.1.1

IP4.DNS[1]:                             192.168.1.1

IP4.DOMAIN[1]:                          example.com

DHCP4.OPTION[1]:                        requested_domain_search = 1

DHCP4.OPTION[2]:                        requested_nis_domain = 1

DHCP4.OPTION[3]:                        requested_time_offset = 1

DHCP4.OPTION[4]:                        requested_broadcast_address = 1

DHCP4.OPTION[5]:                        requested_rfc3442_classless_static_routes = 1

DHCP4.OPTION[6]:                        requested_classless_static_routes = 1

DHCP4.OPTION[7]:                        requested_domain_name = 1

DHCP4.OPTION[8]:                        expiry = 1428293140

DHCP4.OPTION[9]:                        domain_name = example.com

DHCP4.OPTION[10]:                       next_server = 0.0.0.0

DHCP4.OPTION[11]:                       broadcast_address = 192.168.1.255

DHCP4.OPTION[12]:                       dhcp_message_type = 5

DHCP4.OPTION[13]:                       requested_subnet_mask = 1

DHCP4.OPTION[14]:                       dhcp_lease_time = 86400

DHCP4.OPTION[15]:                       routers = 192.168.1.1

DHCP4.OPTION[16]:                       ip_address = 192.168.1.112

DHCP4.OPTION[17]:                       requested_static_routes = 1

DHCP4.OPTION[18]:                       requested_interface_mtu = 1

DHCP4.OPTION[19]:                       requested_nis_servers = 1

DHCP4.OPTION[20]:                       requested_wpad = 1

DHCP4.OPTION[21]:                       requested_ntp_servers = 1

DHCP4.OPTION[22]:                       requested_domain_name_servers = 1

DHCP4.OPTION[23]:                       domain_name_servers = 192.168.1.1

DHCP4.OPTION[24]:                       requested_ms_classless_static_routes = 1

DHCP4.OPTION[25]:                       requested_routers = 1

DHCP4.OPTION[26]:                       subnet_mask = 255.255.255.0

DHCP4.OPTION[27]:                       network_number = 192.168.1.0

DHCP4.OPTION[28]:                       requested_host_name = 1

DHCP4.OPTION[29]:                       dhcp_server_identifier = 192.168.1.1

Let’s create a new connection (mystatic), but this time using a static IP address configuration, as shown below:

[root@oel73 ~]# nmcli con add con-name "mystatic" ifname ens33 autoconnect yes type ethernet ip4 192.168.1.98/24 gw4 192.168.1.1

Connection 'mystatic' (26aa478c-90e6-4172-9e17-07004e61478d) successfully added.

Some of the options deserve a quick explanation:

  • con-name  specifies the name of the connection (mystatic)
  • if-name specifies the name of the device (ens33)
  • autoconnect yes specifies that this connection should be made active at boot
  • type ethernet  specifies the OSI layer 2
  • ip4192.168.1.98/24 specifies an IP address version 4 address and mask
  • gw4192.168.1.1specifies the default router

To list the connections, execute the following:

[root@oel73 ~]# nmcli con show

NAME           UUID                                   TYPE            DEVICE     

myconnection   a4f95890-34b4-457c-bedd-567b9560ec36   802-3-ethernet  ens33      

Auto Ethernet  42cc5b4c-b574-41dc-9d3f-ddd6ec0e38d3   802-3-ethernet  --         

virbr0-nic     7d787f69-5536-4a95-8348-6bff621e1b05   generic         virbr0-nic 

virbr0         b70e08f1-1a85-449d-be7c-9a68d5942c63   bridge          virbr0     

mystatic       26aa478c-90e6-4172-9e17-07004e61478d   802-3-ethernet  --

To make mystatic active, execute these commands:

[root@oel73 ~]# nmcli con show --active

NAME           UUID                                  TYPE            DEVICE     

myconnection   a4f95890-34b4-457c-bedd-567b9560ec36  802-3-ethernet  ens33      

virbr0-nic     7d787f69-5536-4a95-8348-6bff621e1b05  generic         virbr0-nic 

virbr0         b70e08f1-1a85-449d-be7c-9a68d5942c63  bridge          virbr0     

[root@oel73 ~]# nmcli con up "mystatic"

Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/5)

[root@oel73 ~]# nmcli con show --active

NAME           UUID                                  TYPE            DEVICE     

virbr0-nic     7d787f69-5536-4a95-8348-6bff621e1b05  generic         virbr0-nic 

virbr0         b70e08f1-1a85-449d-be7c-9a68d5942c63  bridge          virbr0     

mystatic       26aa478c-90e6-4172-9e17-07004e61478d  802-3-ethernet  ens33      

[root@oel73 ~]# ip addr show ens33

2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000

    link/ether 00:0c:29:c4:c1:47 brd ff:ff:ff:ff:ff:ff

    inet 192.168.1.98/24 brd 192.168.1.255 scope global ens33

    inet6 fe80::20c:29ff:fec4:c147/64 scope link 

       valid_lft forever preferred_lft forever

The mystatic connection has the following attributes:

[root@oel73 ~]# nmcli con show "mystatic" | grep ipv4

ipv4.method:                           manual

ipv4.dns:                              

ipv4.dns-search:                       

ipv4.addresses:                        { ip = 192.168.1.98/24, gw = 192.168.1.1 }

ipv4.routes:                           

ipv4.ignore-auto-routes:               no

ipv4.ignore-auto-dns:                  no

ipv4.dhcp-client-id:                   --

ipv4.dhcp-send-hostname:               yes

ipv4.dhcp-hostname:                    --

ipv4.never-default:                    no

ipv4.may-fail:                         yes

As we can see, there isn’t any DNS configuration. Thus, to configure the DNS (primary and second DNS servers), execute the following:

[root@oel73 ~]# nmcli con mod "mystatic" ipv4.dns 8.8.8.8

[root@oel73 ~]# nmcli con mod "mystatic" +ipv4.dns 8.8.4.4

To change the domain search name, run this command:

[root@oel73 ~]# nmcli con mod "mystatic" ipv4.dns-search example.com

The new settings become active only after restarting the connection, as shown below:

[root@oel73 ~]# nmcli con down "mystatic"

[root@oel73 ~]# nmcli con up "mystatic"

Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/9)

To check the new DNS settings, run the following:

[root@oel73 ~]# nmcli con show "mystatic" | grep ipv4.dns

ipv4.dns:                               8.8.8.8, 8.8.4.4

ipv4.dns-search:                        example.com

If we need to change the IP address of the mystatic connection (keeping the default gateway), then we have to execute the following commands:

[root@oel73 ~]# nmcli con mod "mystatic" ipv4.addresses "192.168.1.86/24 192.168.1.1" 

[root@oel73 ~]# nmcli con down "mystatic"

[root@oel73 ~]# nmcli con up "mystatic"

Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/13)

[root@oel73 ~]# nmcli con show "mystatic" | grep -i ip4.address

IP4.ADDRESS[1]:                         ip = 192.168.1.86/24, gw = 192.168.1.1

When the mystatic connection was created, the autoconnect attribute was set to yes. The problem is that the myconnection connection also has the autoconnect attribute set to yes. Therefore, we have to change one of them to no and this change can be done by executing the following commands:

[root@oel73 ~]# nmcli con mod "myconnection" connection.autoconnect no

[root@oel73 ~]# nmcli con show "myconnection" | grep -i autoconnect

connection.autoconnect:                 no

If we wish to delete a connection, run the following:

[root@oel73 ~]# nmcli con delete "Auto Ethernet"

To make sure that everything is working, we can reboot the Oracle Linux 7 system:

[root@oel73 ~]# systemctl reboot

[root@oel73 ~]# ip addr show ens33

2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000

    link/ether 00:0c:29:c4:c1:47 brd ff:ff:ff:ff:ff:ff

    inet 192.168.1.86/24 brd 192.168.1.255 scope global ens33

    inet6 fe80::20c:29ff:fec4:c147/64 scope link 

       valid_lft forever preferred_lft forever

To verify network access from the current system to Oracle’s website, we can run the traceroutecommand using the –I option (which uses ICMP rather than UDP), as shown below:

[root@oel73 ~]# traceroute -I www.oracle.com

traceroute to www.oracle.com (23.216.182.140), 30 hops max, 60 byte packets

 1  192.168.1.1 (192.168.1.1)  0.449 ms  0.541 ms  0.470 ms

 2  192.168.0.1 (192.168.0.1)  1.404 ms  2.343 ms  2.878 ms

 3  * * *

 4  c906009d.virtua.com.br (201.6.0.157)  60.403 ms  60.372 ms  60.313 ms

 5  c9062985.virtua.com.br (201.6.41.133)  61.191 ms  62.129 ms  62.076 ms

 6  embratel-T0-0-1-1-uacc03.spomb.embratel.net.br (201.64.46.13)  61.012 ms  16.462 ms  17.325 ms

 7  200.244.212.105 (200.244.212.105)  25.647 ms 200.244.212.77 (200.244.212.77)  31.840 ms 200.244.212.75 (200.244.212.75)  30.765 ms

 8  200.244.212.71 (200.244.212.71)  38.244 ms ebt-B10-tcore01.spo.embratel.net.br (200.230.0.2)  36.754 ms  36.295 ms

 9  200.230.231.89 (200.230.231.89)  35.309 ms  35.749 ms ebt-T0-2-5-0-tacc02.spo.embratel.net.br (200.230.158.69)  36.877 ms

10  189.2.4.130 (189.2.4.130)  33.618 ms  49.345 ms  49.257 ms

11  a23-216-182-140.deploy.static.akamaitechnologies.com (23.216.182.140)  47.033 ms  47.936 ms  56.556 ms

Sometimes we could face problems when using the conventional traceroute command with the ICMP protocol. To circumvent this problem, we should use UDP packets, but they are usually blocked and, even when firewalls allow UDP traffic, the traceroute command fails.

The reason for the traceroute command failing when the target website allows UDP packets is that even we are able to set up the starting port by using the –p option, the destination port is increased by one for each interaction, and firewalls usually block lots of ports that are essential for a website to work. A long time ago, Michael Schiffman created a patched traceroute (version 1.4a13), which can be downloaded here: http://packetfactory.openwall.net/projects/firewalk/dist/traceroute/traceroute-1.4a12-packetfatory.tar.gz. (The correct file is downloaded even though the URL contains “1.4a12.”). It has the –S option, which forces the destination port number to a fixed value. This patched version of traceroute is used by many security professionals (including myself). To compile it, run these commands:

[root@oel73 ~]# tar zxvf traceroute-1.4a12-packetfatory.tar.gz

[root@oel73 ~]# cd traceroute-1.4a13/

[root@oel73 traceroute-1.4a13]# cp -r linux-include/ /usr/include/

[root@oel73 traceroute-1.4a13]# cd /usr/include/netinet/

[root@oel73 netinet]# cp * ../linux-include/netinet/

cp: overwrite ‘../linux-include/netinet/in_systm.h’? n

cp: overwrite ‘../linux-include/netinet/ip.h’? n

cp: overwrite ‘../linux-include/netinet/ip_icmp.h’? n

cp: overwrite ‘../linux-include/netinet/udp.h’? n

Edit the traceroute.c file and change the following lines from:

#include <netinet/in_systm.h>

#include <netinet/in.h>

#include <netinet/ip.h>

#include <netinet/ip_var.h>

#include <netinet/ip_icmp.h>

#include <netinet/udp.h>

#include <netinet/udp_var.h>

To this:

#include <linux-include/netinet/in_systm.h>

#include <linux-include/netinet/in.h>

#include <linux-include/netinet/ip.h>

#include <linux-include/netinet/ip_var.h>

#include <linux-include/netinet/ip_icmp.h>

#include <linux-include/netinet/udp.h>

#include <linux-include/netinet/udp_var.h>

Run the configuration script:

[root@oel73 traceroute-1.4a13]# ./configure

[root@oel73 traceroute-1.4a13]# make

Once more, most firewalls don’t allow UDP packets coming from the internet. However, in case we find one that allows them, fixing the destination port to 53 (usually opened and used by the DNS service) will increase our chances. The suggested syntax to perform this task would be the following:

[root@oel73 traceroute-1.4a13]# ./traceroute -S -p53 192.168.1.115

This question about security is out of scope for this article, but it is good to dedicate some time to study it.

Checking Network Files and Changing a Host Name

Although manually editing network files has been a frequently used approach by administrators, the nmclicommand offers a simple and robust interface to do this task without running any risks.

Anyway, it’s possible to change the network configuration by editing the network files. For example, we can verify our mystatic connection by executing the following commands:

[root@oel73 ~]# cd /etc/sysconfig/network-scripts/

[root@oel73 network-scripts]# more ifcfg-mystatic

TYPE=Ethernet

BOOTPROTO=none

DEFROUTE=yes

IPV4_FAILURE_FATAL=no

IPV6INIT=yes

IPV6_AUTOCONF=yes

IPV6_DEFROUTE=yes

IPV6_FAILURE_FATAL=no

NAME=mystatic

UUID=26aa478c-90e6-4172-9e17-07004e61478d

DEVICE=ens33

ONBOOT=yes

DNS1=8.8.8.8

DNS2=8.8.4.4

DOMAIN=example.com

IPADDR=192.168.1.86

PREFIX=24

GATEWAY=192.168.1.1

IPV6_PEERDNS=yes

IPV6_PEERROUTES=yes

If we change this file or any other network configuration file by using a text editor, we have to execute the following commands for the changes to take effect:

[root@oel73 network-scripts]# nmcli con reload

[root@oel73 network-scripts]# nmcli con down "mystatic"

[root@oel73 network-scripts]# nmcli con up "mystatic"

Finally, to change the system’s host name, execute these commands:

[root@oel73 ~]# hostname

oel73.example.com

[root@oel73 ~]# hostnamectl set-hostname myoracle.example.com

[root@oel73 ~]# hostname

myoracle.example.com

[root@oel73 ~]# more /etc/hostname

myoracle.example.com

Edit the /etc/hosts file to reflect the new host name and to make the name resolution work:

[root@oel73 ~]# more /etc/hosts | grep myoracle

192.168.1.86myoracle.example.com myoracle

To see the summarized system information, execute the following:

[root@oel73 ~]# hostnamectl status

   Static hostname: myoracle.example.com

         Icon name: computer

           Chassis: n/a

        Machine ID: 4b2c3503d92b46d39c4f71a40716fee3

           Boot ID: 10a9f862daab4319a682287d730211bf

    Virtualization: vmware

  Operating System: Oracle Linux Server 7.0

       CPE OS Name: cpe:/o:oracle:oracle_linux:7.0:GA:server

            Kernel: Linux 3.8.13-55.1.5.el7uek.x86_64

      Architecture: x86_64

As we saw, network management on Oracle Linux 7 is a simple and straightforward task that any administrator will be involved with on a regular basis.

See Also

Here are some links to other things I’ve written:

Alexandre Borges

Alexandre Borges

Alexandre Borges é Oracle Ace Solaris, instrutor Oracle, Brocade, (ISC)2 e EC-Council. Também é autor do “Oracle Solaris 11 Advanced Administration” e revisor do livro “vSphere Security”.

Ministra cursos sobre Malware Analysis, Memory Forensic Analysis, Software Exploitation, Digital Forensics e Hacking. Alexandre palestrou sobre esses temas em conferências como Hackers to Hackers Conference (H2HC), MindTheSec, Secure Brazil e em diversas universidades.

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *

plugins premium WordPress