0

I have in a ubuntu server an interface setup as the following

(in /etc/network/interfaces)

address xxx.xxx.xxx.xxx
netmask 255.255.255.255
broadcast xxx.xxx.xxx.xxx
post-up route add xxx.xxx.xxx.xxx dev eth0
post-up route add default gw xxx.xxx.xxx.xxx
post-down route del xxx.xxx.xxx.xxx dev eth0
post-down route del default gw xxx.xxx.xxx.xxx

I am wondering how can I use this configuration in a centos 7 server (in /etc/sysconfig/network-scripts/ifcfg-ens18)

2

I would use the nmtui command-line tool (from the package NetworkManager-tui) to configure the network settings (you can set up custom routes there), and then have a look at the configuration file it produces. I have found that a lot easier than trying to edit the NetworkManager configuration files directly.

  • The tool works great, but I added the file play way... – phper Jul 13 '15 at 10:48
1

Ok, so this is how

/etc/sysconfig/network-scripts/ifcfg-ens18

DEVICE=ens18
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
IPV6INIT=no
PEERDNS=yes
TYPE=Ethernet
NETMASK=255.255.255.255
IPADDR=xxx.xxx.xxx.xxx
GATEWAY=xxx.xxx.xxx.xxx
ARP=yes
HWADDR=MA:MAC:VI:RT:UEL:LE

/etc/sysconfig/network-scripts/route-ens18

xxx.xxx.xxx.xxx dev ens18
default via xxx.xxx.xxx.xxx dev ens18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.