[SOLVED] Missing Entry from /etc/sysconfig/network-scripts

Issues related to configuring your network
Post Reply
Ballistic Alpaca
Posts: 2
Joined: 2015/09/06 05:44:11

[SOLVED] Missing Entry from /etc/sysconfig/network-scripts

Post by Ballistic Alpaca » 2015/09/06 06:44:39

I have CentOS 7 Minimal Install in a VirtualBox 5 guest.
There are two NICs enabled. One is a NAT, one is a Host-only. I want to set a static IP address for the host-only NIC.

I can connect to the host-only NIC via SSH.
I see it when I do ip addr.
But I don't see it in /etc/sysconfig/network-scripts.

Code: Select all

[cyberdemon@doom-dc1 ~]$ ip addr
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
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:5c:e9:c0 brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic enp0s3
       valid_lft 79334sec preferred_lft 79334sec
    inet6 fe80::a00:27ff:fe5c:e9c0/64 scope link 
       valid_lft forever preferred_lft forever
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:bd:23:1c brd ff:ff:ff:ff:ff:ff
    inet 10.1.1.102/16 brd 10.1.255.255 scope global dynamic enp0s8
       valid_lft 724sec preferred_lft 724sec
    inet6 fe80::a00:27ff:febd:231c/64 scope link 
       valid_lft forever preferred_lft forever
[cyberdemon@doom-dc1 ~]$ cd /etc/sysconfig/network-scripts
[cyberdemon@doom-dc1 network-scripts]$ dir
ifcfg-enp0s3  ifdown-ipv6    ifdown-TeamPort  ifup-ippp   ifup-routes	    network-functions
ifcfg-lo      ifdown-isdn    ifdown-tunnel    ifup-ipv6   ifup-sit	       network-functions-ipv6
ifdown	     ifdown-post    ifup	          ifup-isdn   ifup-Team
ifdown-bnep   ifdown-ppp     ifup-aliases     ifup-plip   ifup-TeamPort
ifdown-eth    ifdown-routes  ifup-bnep	     ifup-plusb  ifup-tunnel
ifdown-ib     ifdown-sit     ifup-eth	      ifup-post   ifup-wireless
ifdown-ippp   ifdown-Team    ifup-ib	       ifup-ppp    init.ipv6-global
[cyberdemon@doom-dc1 network-scripts]$ 
The NAT is enp0s3, and the host-only is enp0s8.

I saw this
viewtopic.php?f=16&t=45173
and considered making an entry for ifcfg-enp0s8, but the example in the above link looks like this

Code: Select all

DEVICE=eth1
BOOTPROTO=static
IPADDR=your_IP
NETMASK=your_network_mask
HWADDR=NIC_MAC_address
NM_CONTROLLED=no
ONBOOT=yes
TYPE=Ethernet
IPV6INIT=no
and the contents of ifcfg-enp0s3 look like this

Code: Select all

TYPE="Ethernet"
BOOTPROTO="dhcp"
DEFROUTE="yes"
PEERDNS="yes"
PEERROUTES="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_PEERDNS="yes"
IPV6_PEERROUTES="yes"
IPV6_FAILURE_FATAL="no"
NAME="enp0s3"
UUID="13d2bc46-dba3-415a-a820-5a4b228d7eeb"
DEVICE="enp0s3"
ONBOOT="yes"
Totally different.
I don't know where to find or generate that UUID for enp0s8.

What do I need to do to resolve this so I may set a static IP address for enp0s8?

Thanks in advance.
Last edited by Ballistic Alpaca on 2015/09/06 15:56:32, edited 2 times in total.

User avatar
barry905
Posts: 89
Joined: 2014/07/18 02:11:38

Re: Missing Entry from /etc/sysconfig/network-scripts

Post by barry905 » 2015/09/06 08:10:20

I don't use dhcp on Linux machines in my network, but you might try this and see it if helps:

http://www.itechlounge.net/2014/03/linu ... helcentos/

It seems to give you what you want.

Ballistic Alpaca
Posts: 2
Joined: 2015/09/06 05:44:11

Re: Missing Entry from /etc/sysconfig/network-scripts

Post by Ballistic Alpaca » 2015/09/06 15:44:29

I seem to have gotten it sorted out.
I found the following two links helpful.

http://ask.xmodulo.com/configure-static ... ntos7.html
https://access.redhat.com/documentation ... nmcli.html

I checked the status of the connections, and got the UUID for the one missing a config file.

Code: Select all

[cyberdemon@doom-dc1 network-scripts]$ systemctl status NetworkManager.service
NetworkManager.service - Network Manager
   Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled)
   Active: active (running) since Sun 2015-09-06 10:46:13 EDT; 5min ago
 Main PID: 681 (NetworkManager)
   CGroup: /system.slice/NetworkManager.service
           ├─ 681 /usr/sbin/NetworkManager --no-daemon
           ├─1504 /sbin/dhclient -d -q -sf /usr/libexec/nm-dhcp-helper -pf /var/run/dhclient-enp0s3.pid...
           └─1724 /sbin/dhclient -d -q -sf /usr/libexec/nm-dhcp-helper -pf /var/run/dhclient-enp0s8.pid...

[cyberdemon@doom-dc1 network-scripts]$ nmcli dev status
DEVICE  TYPE      STATE      CONNECTION         
enp0s3  ethernet  connected  enp0s3             
enp0s8  ethernet  connected  Wired connection 1 
lo      loopback  unmanaged  --                 
[cyberdemon@doom-dc1 network-scripts]$ nmcli con show
NAME                UUID                                  TYPE            DEVICE 
Wired connection 1  3f4d0c27-5594-4847-ad5e-76c6d667edf9  802-3-ethernet  enp0s8 
enp0s3              13d2bc46-dba3-415a-a820-5a4b228d7eeb  802-3-ethernet  enp0s3 
[cyberdemon@doom-dc1 network-scripts]$
Then I created ifcfg-enp0s8 with vi, with the following settings:

Code: Select all

TYPE="Ethernet"
BOOTPROTO="static"
IPADDR=10.1.1.5
DEFROUTE="yes"
PEERDNS="yes"
PEERROUTES="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_PEERDNS="yes"
IPV6_PEERROUTES="yes"
IPV6_FAILURE_FATAL="no"
NAME="enp0s8"
UUID="3f4d0c27-5594-4847-ad5e-76c6d667edf9"
DEVICE="enp0s8"
ONBOOT="yes"
I was able to reconnect my ssh session to the new static IP address, and it shows when I check it with ip addr. So I think I'm good to go.

There are ways to edit these settings with nmcli instead of editing the config file, and I am going to familiarize myself with those commands, as they will probably be more useful should I need to script this sort of thing.

barry905, I'll save that link you provided in case I need it at some point in the future. I did try using it, and it generated a UUID, but it didn't match the one I saw when I later ran nmcli con show, so I didn't use it.

Thanks.

Post Reply