LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-28-2017, 06:45 AM   #1
sysmicuser
Member
 
Registered: Mar 2010
Posts: 421

Rep: Reputation: 0
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
 
Old 02-28-2017, 07:20 AM   #2
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
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
 
Old 02-28-2017, 03:53 PM   #3
jefro
Moderator
 
Registered: Mar 2008
Posts: 19,217

Rep: Reputation: 2926Reputation: 2926Reputation: 2926Reputation: 2926Reputation: 2926Reputation: 2926Reputation: 2926Reputation: 2926Reputation: 2926Reputation: 2926Reputation: 2926
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
 
Old 03-01-2017, 04:13 AM   #4
sysmicuser
Member
 
Registered: Mar 2010
Posts: 421

Original Poster
Rep: Reputation: 0
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...
 
Old 03-01-2017, 03:24 PM   #5
jefro
Moderator
 
Registered: Mar 2008
Posts: 19,217

Rep: Reputation: 2926Reputation: 2926Reputation: 2926Reputation: 2926Reputation: 2926Reputation: 2926Reputation: 2926Reputation: 2926Reputation: 2926Reputation: 2926Reputation: 2926
Might see this for clues. https://wiki.centos.org/FAQ/CentOS7#...dd5315906fa493
 
Old 03-01-2017, 03:29 PM   #6
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,237

Rep: Reputation: 1651Reputation: 1651Reputation: 1651Reputation: 1651Reputation: 1651Reputation: 1651Reputation: 1651Reputation: 1651Reputation: 1651Reputation: 1651Reputation: 1651
What does your vagrant file look like?

paste here if it is huge: https://paste.fedoraproject.org/
 
Old 03-05-2017, 03:51 AM   #7
sysmicuser
Member
 
Registered: Mar 2010
Posts: 421

Original Poster
Rep: Reputation: 0
Unhappy

@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 ~]#
 
Old 03-07-2017, 04:44 PM   #8
sysmicuser
Member
 
Registered: Mar 2010
Posts: 421

Original Poster
Rep: Reputation: 0
@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.
 
Old 03-07-2017, 05:34 PM   #9
jefro
Moderator
 
Registered: Mar 2008
Posts: 19,217

Rep: Reputation: 2926Reputation: 2926Reputation: 2926Reputation: 2926Reputation: 2926Reputation: 2926Reputation: 2926Reputation: 2926Reputation: 2926Reputation: 2926Reputation: 2926
Thanks for the update and solution.

Wonder what the bug was and the update did?
 
1 members found this post helpful.
Old 03-22-2017, 04:19 PM   #10
sysmicuser
Member
 
Registered: Mar 2010
Posts: 421

Original Poster
Rep: Reputation: 0
@jefro,

Not sure about it.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to change the network default eth0/eth1 in F12??? ReneZ Fedora 6 12-06-2010 11:50 AM
newbie question - how do I configure fedora 10 to automatically enable eth1? zebrose Linux - Newbie 4 03-29-2009 09:56 AM
eth1 always down by default FirebirdV0273 Linux - Networking 3 07-24-2007 10:58 AM
How do you switch the default ethernet adapter (eth0 to eth1)? scoobdoobery Linux - Networking 3 09-05-2004 01:29 PM
enable eth1 and dhcp on start up dag33k Linux - Networking 5 03-05-2004 04:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration