LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to enable eth1 by default on centos 7 (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-enable-eth1-by-default-on-centos-7-a-4175600760/)

sysmicuser 02-28-2017 06:45 AM

how to enable eth1 by default on centos 7
 
Hi Guys,

I have provisioned a Centos 7 machine with vagrant and eth1 inteface is always down when I start the machine.

I bring it up by issuing command

ifup eth1

Is there anyway to bring it up by default? I want eth1 to be up and eth0 to be down when machine boots up.

Thanks

r3sistance 02-28-2017 07:20 AM

What tools are you using for setting up the device? That would help but The most likely surefire method is to edit onboot to yes in /etc/sysconfig/network-scripts/ifcfg-eth1

jefro 02-28-2017 03:53 PM

Usually Centos 7 has predictable naming for it's network adapters. Did you change it so that you could use the old naming scheme? https://access.redhat.com/documentat...ce_Naming.html

sysmicuser 03-01-2017 04:13 AM

Code:

[root@192-168-1-51 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
#VAGRANT-BEGIN
# The contents below are automatically generated by Vagrant. Do not modify.
NM_CONTROLLED=no
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.1.51
NETMASK=255.255.255.0
DEVICE=eth1
PEERDNS=no
#VAGRANT-END
[root@192-168-1-51 ~]#

No I did not changed anything I just enabled two network interfaces when I saw the machine in Virtual box. The machine was provisioned with vagrant

Still the puzzle is not resolved...

jefro 03-01-2017 03:24 PM

Might see this for clues. https://wiki.centos.org/FAQ/CentOS7#...dd5315906fa493

szboardstretcher 03-01-2017 03:29 PM

What does your vagrant file look like?

paste here if it is huge: https://paste.fedoraproject.org/

sysmicuser 03-05-2017 03:51 AM

@jefro

ONBOOT=yes for both interfaces.

Vagrantfile
Code:

Vagrant.configure("2") do |o|
o.vm.box="centos/7"
o.vm.network "public_network", ip: "192.168.1.51"
o.vm.provision "shell", :path=>"setup.sh"
end

setup.sh
Code:

yum -y upgrade  --exclude kernel*
yum -y install vim git gedit nmap unzip httpd
yum -y install httpd
systemctl restart httpd

Code:

[root@192-168-1-51 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
#VAGRANT-BEGIN
# The contents below are automatically generated by Vagrant. Do not modify.
NM_CONTROLLED=no
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.1.51
NETMASK=255.255.255.0
DEVICE=eth1
PEERDNS=no
#VAGRANT-END
[root@192-168-1-51 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="dhcp"
ONBOOT="yes"
TYPE="Ethernet"
PERSISTENT_DHCLIENT="yes"
[root@192-168-1-51 ~]#


sysmicuser 03-07-2017 04:44 PM

@ALL,

This is resolved. Supposed to be a bug in Vagrant 1.9.1. Upgraded to 1.9.2 and issue is resolved.

Thank you all for your guidance.

jefro 03-07-2017 05:34 PM

Thanks for the update and solution.

Wonder what the bug was and the update did?

sysmicuser 03-22-2017 04:19 PM

@jefro,

Not sure about it.


All times are GMT -5. The time now is 01:20 PM.