Definitive way to configure network devices in Centos 6.2

5,115

Use NetworkManager, that is the way forward. It used to do weird things a while back, but that has been ironed out now. If you have some exotic setup, try to integrate it there. Only edit the files under /etc/sysconfig/network-scripts by hand as last resort.

Share:
5,115

Related videos on Youtube

A G
Author by

A G

Updated on September 18, 2022

Comments

  • A G
    A G over 1 year

    What is the definitive way to configure network devices in Centos 6.2? Via network manager or editing /etc/sysconfig/network-scripts?

    I have a notebook with 1 ethernet port and a usb ethernet adapter plugged in.

    When I do ip link show I see eth0 and em1. However when I go to /etc/sysconfig/network-scripts, there is an ifcfg-eth0 file and ifcfg-usb0, but no ifcfg-em1.

    The network manager applet shows under Wired connections System eth0 and System usb0. I have set eth0 to 10.0.4.24 and usb0 to use dhcp under the network manager applet.

    When I remove usb ethernet device, ip link show only shows em1. Does this mean em1 maps to eth0? However as eth0 is no longer there (because the usb adapter has been removed), does that mean usb0 also maps to eth0?

    My problem is that when I do an ifconfig, BOTH em1 and eth0 show an ip address of 10.0.4.24.

    PS should this belong here or at serverfault?

    edit: added requested output:

    # more 70-persistent-net.rules 
    # This file was automatically generated by the /lib/udev/write_net_rules
    # program, run by the persistent-net-generator.rules rules file.
    #
    # You can modify it, as long as you keep each rule on a single
    # line, and change only the value of the NAME= key.
    
    # PCI device 0x8086:0x422b (iwlagn)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="24:77:03:74:85:98", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"
    
    # USB device 0x0b95:0x7720 (usb)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:b6:50:b5:fc", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
    
    ---------------------
    
    # more ifcfg-eth0 
    DEVICE="eth0"
    BOOTPROTO=none
    #HWADDR="00:21:70:B9:4C:9F" # Commented by Clonezilla
    NM_CONTROLLED="yes"
    ONBOOT="yes"
    TYPE="Ethernet"
    DEFROUTE=yes
    IPV4_FAILURE_FATAL=yes
    IPV6INIT=no
    NAME="System eth0"
    UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
    IPADDR=10.0.4.24
    PREFIX=24
    
    -----------------------
    
    # more ifcfg-usb0 
    DEVICE="usb0"
    NM_CONTROLLED="yes"
    ONBOOT="no"
    TYPE=Ethernet
    BOOTPROTO=dhcp
    DEFROUTE=yes
    IPV4_FAILURE_FATAL=yes
    IPV6INIT=no
    NAME="System usb0"
    UUID=689ce77b-bfa1-c10b-19a2-eb3a89251128
    HWADDR=02:80:37:EC:02:00
    PEERDNS=yes
    PEERROUTES=yes
    
    -------------------------
    
    # ifconfig
    em1       Link encap:Ethernet  HWaddr D4:BE:D9:2B:D3:72  
              inet addr:10.0.4.24  Bcast:10.0.4.255  Mask:255.255.255.0
              inet6 addr: fe80::d6be:d9ff:fe2b:d372/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:120 errors:0 dropped:0 overruns:0 frame:0
              TX packets:57 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:11475 (11.2 KiB)  TX bytes:10552 (10.3 KiB)
              Interrupt:20 Memory:e6e00000-e6e20000 
    
    eth0      Link encap:Ethernet  HWaddr 00:50:B6:50:B5:FC  
              inet addr:10.0.4.24  Bcast:10.0.4.255  Mask:255.255.255.0
              inet6 addr: fe80::250:b6ff:fe50:b5fc/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:1000 errors:0 dropped:0 overruns:0 frame:0
              TX packets:473 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:87868 (85.8 KiB)  TX bytes:56643 (55.3 KiB)
    

    Note there is no entry in ifconfig or ip link for usb0

    • Krzysztof Księżyk
      Krzysztof Księżyk over 11 years
      Please paste here output of following files: /etc/udev/rules.d/70-persistent-net.rules /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-usb0
    • A G
      A G over 11 years
      hi, added the output to the bottom of the question