Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have physical network card for Internet and I want to create a virtual one on Linux.

This is my configuration on /etc/network/interfaces

# Public
auto eth0
iface eth0 inet static
        address 46.40.127.45
        netmask 255.255.255.0
        network 46.40.127.0
        broadcast 46.40.127.255
        gateway 46.40.127.1
        dns-nameservers 8.8.8.8
        dns-search com

# Private
auto eth1
iface eth1 inet static
        address 10.10.10.1
        netmask 255.255.255.0

This is what I've got when I /etc/init.d/networking restart

Cannot find device "eth1"
Failed to bring up eth1.
share|improve this question
    
What precisely do you mean by "a virtual one"? What exactly are you trying to do? –  David Schwartz Oct 14 '13 at 11:05
add comment

2 Answers

up vote 2 down vote accepted

Well you need to specify which hardware interface it connects to.

Try this,

# Public
auto eth0
iface eth0 inet static
        address 46.40.127.45
        netmask 255.255.255.0
        network 46.40.127.0
        broadcast 46.40.127.255
        gateway 46.40.127.1
        dns-nameservers 8.8.8.8
        dns-search com

# Private
auto eth0:1
iface eth0:1 inet static
        address 10.10.10.1
        netmask 255.255.255.0

Details can be found here

share|improve this answer
add comment

Mrinal's suggestion is correct, but it is deprecated now, ad actually has been for quite some time (a couple of years)? The correct way is by means of new utility iproute2. For instance, to add a new virtual interface, you should use (from the ip link man page):

 ip link add link eth0 name eth0.10 type vlan id 10
       Creates a new vlan device eth0.10 on device eth0.

   ip link delete dev eth0.10
       Removes vlan device.

Edit: to find out which network-related features are deprecated, apart from searching for "linux deprecated iproute2" on Google, try this: http://lists.debian.org/debian-devel/2009/03/msg00780.html or this http://dougvitale.wordpress.com/2011/12/21/deprecated-linux-networking-commands-and-their-replacements/ or Wikipedia: http://en.wikipedia.org/wiki/Ifconfig

share|improve this answer
    
Ok, so how does one do that from /etc/network/interfaces? –  Jan Hudec Oct 14 '13 at 11:55
    
Can you also edit your post with a link to where the "virtual interface" approach is depreciated? –  Craig Watson Oct 14 '13 at 11:57
    
@craig: done. Jan, which distro? –  MariusMatutiae Oct 14 '13 at 13:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.