How would I go about installing eth0 on CentOS? When I do ifconfig -a, eth0 is not there. Here is the output of ip link:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
3: venet0: <BROADCAST,POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue
  • 1
    What do you mean by installng eth0? Is CentOS not seeing your network card? What is the output of the ip link command? Also, what CentOS version are you using? Jun 23, 2014 at 19:43
  • What card is it?
    – schaiba
    Jun 23, 2014 at 19:49
  • What do you mean by what card?
    – user68973
    Jun 23, 2014 at 19:54
  • @user68973, are you using a virtual private server (VPS)? Jun 23, 2014 at 19:55
  • Yes, I am. It's Linux.
    – user68973
    Jun 23, 2014 at 19:59

2 Answers 2


Network interfaces can have different names on Linux depending on their type (wired Ethernet, Wi-Fi, PPP, SLIP, etc.), PCI slot, initialization order, etc. For example if a computer has a single Ethernet card, its name would be eth0*.

In your case, there's a virtual private server without an Ethernet network card in it, not even an emulated one. Nevertheless you have a network card named venet0. You can rename it with:

ip link set venet0 name eth0

If the interface is in use the command will fail, so you might need to bring it down (ip link set venet0 down), but this will probably disconnect you from the server.

If you're willing to take the risk, you could run in the background a script that brings the interface down, renames it, then brings it up. First get the settings for venet0 and the routing table:

[root@server ~]# ip addr show dev venet0
2: venet0: <BROADCAST,POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
    inet scope host venet0
    inet X.Y.Z.T/32 brd X.Y.Z.T scope global venet0:0
[root@server ~]# ip ro dev venet0  scope host dev venet0  scope link  metric 1002
default dev venet0  scope link

Then create a script (rename-to-eth0.sh) similar to this:

### Rename
ip link set venet0 down        # Bring interface down
ip link set venet0 name eth0   # Rename interface    
ip link set eth0 up            # Bring interface up
### Restore
# Restore interface settings. Adapt accordingly!!!
ip addr add scope host dev eth0
ip addr add X.Y.Z.T/32 brd X.Y.Z.T scope global label eth0:0 dev eth0
# Restore routing table. Adapt accordingly!!!
ip ro add dev venet0 scope host
ip ro add dev venet0 scope link metric 1002
ip ro add default dev eth0

Now run the script with nohup i.e. nohup ./rename-to-eth0.sh or inside screen, tmux, etc. If it fails, you'll probably have to restart the server.

* Things will change as the "Predictable Network Interface Names" proposal is implemented, although this does not apply to CentOS6 or earlier. Take note that according to this proposal an integrated Ethernet card might be named em1.

  • I tried that it didn't work for the script I have, I need eth0.
    – user68973
    Jun 23, 2014 at 20:29
  • @user68973, I've updated my answer with an (ugly) way to do the rename. Jun 24, 2014 at 0:19
  • +1 for explaining why there isn't an eth0. Any script that has eth0 hardcoded into it sounds like a really badly done piece of work, BTW.
    – goldilocks
    Jun 24, 2014 at 11:43
  • Thank you! I agree regarding the script. And if it's really a script then it should be easier to adapt it (with a plain search&replace perhaps) than mess with this renaming. Jun 24, 2014 at 16:18

If your use of eth0 can simply be modified to refer to the network interface by the name "venet0" wherever you would use "eth0" then you can just do that.

If, however, you have to have the name eth0, you can do something like

sudo ip link set dev venet0 alias eth0

The "sudo" prefix allows you to execute commands as "root" user. If you're already running as root, you can leave this off. In fact, probably you should try it without and if there are no errors then you win!

  • I'd recommend using su -l -c instead of sudo because not every computer has sudo. Jun 23, 2014 at 20:13
  • here is the output of that command Error: either "dev" is duplicate, or "alias" is a garbage.
    – user68973
    Jun 23, 2014 at 20:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .