Reassign network interface

YOYONL
Posts: 8
Joined: Wed Jul 21, 2010 7:36 am

Reassign network interface

Postby YOYONL » Wed Jul 21, 2010 7:41 am

Hello all,

i just have installed amahi for a few days now and i did that on my testbox i have laying around..
The box has 3 network cards installed for various tests and for fun.. :D

Now here the problem i have:
When i installed amahi all 3 cards where present and offcourse eth 0 was the bottem card. Today i have pulled out eth0 as this is a 100 mb card and i would like to test eth 1 which is a 1000mb nic. My thought was if i pull eth0 then eth1 becomes eth0... But the system doesnt think so and now i have a dead amahi box :P i have tried all kind of things within fedora to get eth1 to become eth 0 but to no avail the system keeps saying eth0 is not present.. so what i want is that fedora/amahi resets all nics and reassings them.

Who can help me out here??

User avatar
gboudreau
Posts: 606
Joined: Sat Jan 23, 2010 1:15 pm
Location: Montréal, Canada
Contact:

Re: Reassign network interface

Postby gboudreau » Wed Jul 21, 2010 10:31 am

Maybe try to manually edit /etc/udev/rules.d/70-persistent-net.rules

In mine, I only have one line:

Code: Select all

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:30:67:0c:04:46", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
but I guess yours will have many, and I'd guess deleting the eth0 line, and renaming eth1 to eth0 in there would do the trick (after a reboot).

Good luck.
- Guillaume Boudreau

whetu
Posts: 30
Joined: Tue Jul 13, 2010 3:32 am

Re: Reassign network interface

Postby whetu » Wed Jul 21, 2010 4:43 pm

See my post here for a more thorough description if you need it :)

YOYONL
Posts: 8
Joined: Wed Jul 21, 2010 7:36 am

Re: Reassign network interface

Postby YOYONL » Thu Jul 22, 2010 4:09 am

Hello,

i have done what gboudreau told me in his post and also took a look into youre topic whetu.
i cant really see the difference in both sollutions. :oops: Cause the should have both the same result!

However i managed to get eth 1 to become eth 0 but now amahi doenst seem to start... my control panel can tell me that Amahi is stopped... So why did it stop and didnt came back up?

User avatar
moredruid
Expert
Posts: 791
Joined: Tue Jan 20, 2009 1:33 am
Location: Netherlands
Contact:

Re: Reassign network interface

Postby moredruid » Thu Jul 22, 2010 6:47 am

The below script will switch your NIC hardware settings

Code: Select all

#!/bin/bash # # NAME # switchnics - switch network interface hardware settings # # USAGE # switchnics [-d] iface1 iface2 # # DESCRIPTION # Switch network interface hardware settings originally assigned by # the Red Hat installer, anaconda. The interface configuration files # in /etc/sysconfig/network-scripts are modified so the MAC addresses # are exchanged for the HWADDR shell variables. Optional comment # on line 1 of these files are exchanged and, if necessary, the # driver assignments in /etc/modprobe.conf are switched as well. # # MODIFICATION HISTORY # * Wed Feb 13 2008 George Hacker <ghacker@redhat.com> # - Add the -d option to switch device names instead of HW settings # * Fri Dec 14 2007 George Hacker <ghacker@redhat.com> # - Original code. # fatal() - writes to STDERR, then exits function fatal () { echo "$1" 1>&2; exit $2 } # Check the options to see if the user is a knucklehead if [[ $# -eq 2 ]] then unset SW_DEVICE iface[1]=$1; iface[2]=$2 elif [[ $# -eq 3 && $1 = -d ]] then SW_DEVICE=true iface[1]=$2; iface[2]=$3 else fatal "Usage: $(basename $0) [-d] iface1 iface2" 2 fi if [[ ${iface[1]} = ${iface[2]} ]] then fatal "Error: you specified the same interface" 2 fi exit modprobe=/etc/modprobe.conf ifcfg=/etc/sysconfig/network-scripts/ifcfg- # Determine the drivers for each of the interfaces for i in 1 2 do if grep "alias ${iface[i]}" $modprobe &> /dev/null then driver[i]=$( awk "/${iface[i]}/ { print \$3 }" $modprobe ) else fatal "Error: interface ${iface[i]} does not exist" 1 fi done # Retrieve the interface comment lines and the DEVICE and HWADDR values for i in 1 2 do if [[ ! -w $ifcfg${iface[i]} ]] then fatal "Error: cannot write to $(basename $ifcfg${iface[i]})" 1 fi comment[i]=$( awk 'NR == 1 && /^#/' $ifcfg${iface[i]} ) hwaddr[i]=$( awk -F= '$1 == "HWADDR" { print $2 }' $ifcfg${iface[i]} ) device[i]=$( awk -F= '$1 == "DEVICE" { print $2 }' $ifcfg${iface[i]} ) done # When -d option is used, switch the DEVICE lines, not HWADDR and comments if [[ $SW_DEVICE ]] then TEMP="${device[1]}" ; device[1]="${device[2]}" ; device[2]="$TEMP" else TEMP="${comment[1]}"; comment[1]="${comment[2]}"; comment[2]="$TEMP" TEMP="${hwaddr[1]}" ; hwaddr[1]="${hwaddr[2]}" ; hwaddr[2]="$TEMP" fi # If the drivers are different, modify modprobe.conf if [[ ${driver[1]} != ${driver[2]} ]] then if [[ ! -w $modprobe ]] then fatal "Error: cannot write to $(basename $modprobe)" 1 fi # Switch modprobe.conf entries sed -e "/alias ${iface[1]}/s/${driver[1]}/${driver[2]}/" \ -e "/alias ${iface[2]}/s/${driver[2]}/${driver[1]}/" -i $modprobe fi # Create new and improved interface config files for i in 1 2 do ( if [[ -n ${comment[i]} ]] then echo ${comment[i]} fi awk -F= "BEGIN { OFS=\"=\"} NR == 1 && /^#/ { next } \$1 == \"HWADDR\" { \$2 = \"${hwaddr[i]}\" } \$1 == \"DEVICE\" { \$2 = \"${device[i]}\" } { print }" $ifcfg${iface[i]} ) > $ifcfg${iface[i]}.tmp cp $ifcfg${iface[i]}.tmp $ifcfg${iface[i]} rm $ifcfg${iface[i]}.tmp done # When -d option is used, IP config settings get switched, so files # have to be exchanged if [[ $SW_DEVICE ]] then mv $ifcfg${iface[1]} $ifcfg.tmp mv $ifcfg${iface[2]} $ifcfg${iface[1]} mv $ifcfg.tmp $ifcfg${iface[2]} fi exit 0
echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D2173656C7572206968616D41snlbxq' | dc
Galileo - HP Proliant ML110 G6 quad core Xeon 2.4GHz, 4GB RAM, 2x750GB RAID1 + 2x1TB RAID1 HDD

User avatar
gboudreau
Posts: 606
Joined: Sat Jan 23, 2010 1:15 pm
Location: Montréal, Canada
Contact:

Re: Reassign network interface

Postby gboudreau » Thu Jul 22, 2010 7:08 am

However i managed to get eth 1 to become eth 0 but now amahi doenst seem to start... my control panel can tell me that Amahi is stopped... So why did it stop and didnt came back up?
What does not start exactly ? i.e. what do you call 'Amahi' ?
The Amahi dashboard at http://hda ?
Your server itself (it doesn't boot) ?
Your files shares ?
- Guillaume Boudreau

YOYONL
Posts: 8
Joined: Wed Jul 21, 2010 7:36 am

Re: Reassign network interface

Postby YOYONL » Thu Jul 22, 2010 3:02 pm

The machine and fedora are starting correctly but i dont get the dashboard and i cant see the server in my network..
The script could be the answer but i dont have time until the weekend.... so i let you know when i have an update!

whetu
Posts: 30
Joined: Tue Jul 13, 2010 3:32 am

Re: Reassign network interface

Postby whetu » Thu Jul 22, 2010 11:07 pm

can you please tell us what you get from the following commands:

ifconfig
cat /etc/udev/rules.d/70-persistent-net.rules
cat /etc/sysconfig/network-scripst/ifcfg-eth0

YOYONL
Posts: 8
Joined: Wed Jul 21, 2010 7:36 am

Re: Reassign network interface

Postby YOYONL » Wed Jul 28, 2010 5:33 am

Small update:
Ahmahi itself runs as i can access my HDA on the box itself.. The dashboard comes up nice to! unfortunally there is still no access to the oudside world..

The script i will go and try to get it working now and i will see if i can get the wanted info to for whetu

Edit: Seems like the wrong nic has been assigned as being eth 0. the onboard nic is eth0 and not the card i want but that doenst matter!
Im going to get more tests on the 100mbit if its fine for me im gonna try to install amahi over the production server around here!

Thanks for the help case closed!

Who is online

Users browsing this forum: Google Adsense [Bot] and 19 guests