Manual Network Configuration on CentOS 7 Print

  • 0

 

Manual Network Configuration on CentOS 7

On CentOS 7, the network interface name can vary depending on the environment (bare-metal, cloud, virtualized). Before configuring the network manually, identify the active interface using the following command:

ip addr

 

1. Interface configuration file

Edit or create the file for your network interface:

/etc/sysconfig/network-scripts/ifcfg-[interface_name]

For example, if your interface is named eth0, the file should be ifcfg-eth0.

Recommended content:

DEVICE=[interface_name]
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
IPV6INIT=no
PEERDNS=yes
TYPE=Ethernet
NETMASK=255.255.255.255
IPADDR=[ASSIGNED_IP]
GATEWAY=[ASSIGNED_GATEWAY]
ARP=yes
HWADDR=[MAC_ADDRESS]

Replace the values in brackets with the actual information provided by your hosting provider or network configuration.

 

2. Routing file configuration

If the file doesn't exist, create it using this path:

/etc/sysconfig/network-scripts/route-[interface_name]

Recommended content:

[ASSIGNED_GATEWAY] 255.255.255.255 [interface_name]
[NETWORK_GW_VM] 255.255.255.0 [interface_name]
default [ASSIGNED_GATEWAY]

Note: NETWORK_GW_VM refers to the main IP of your server with the last octet replaced by 0.

 

3. DNS configuration

Edit the file:

/etc/resolv.conf

Recommended content:

nameserver 213.186.33.99

 


Was this answer helpful?

« Back