LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 07-28-2013, 09:55 PM   #1
magpiesally
LQ Newbie
 
Registered: Jul 2013
Posts: 3

Rep: Reputation: Disabled
Thumbs up Assigning dynamic IP addresses on aliases using macvlan?


This is new stuff for me, so I am learning and googling a lot.

My problem is, I want to be able to have interfaces named:

eth0:0

eth0:1

etc...

But I want them each to have a dynamic IP address. I know this works for static, and I know interface aliases can't use dynamic addresses because they share the same MAC address.

But I wondered if there is a way to trick the system using macvlan or some other way?

The reason I want to do this is because I have an application that looks for the ethernet interfaces eth0, eth0:1, eth0:2. I am trying to see if I can avoid using static IPs for these interfaces so there is no potential conflict with another system with the same IP. I have alternative solutions but I just want to know if I can hack this and make it work.

I tried to create macvlans, then ran dhclient on them so they each have their own IP, and then tried to rename them to the eth0:0, eth0:1 etc. But I'm really just hacking at this because I don't totally know what I'm doing yet.

Thanks for trying to help.

Last edited by magpiesally; 07-28-2013 at 09:58 PM.
 
Old 07-29-2013, 02:07 AM   #2
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
Check this out
Not much of an explanation but seems complete.
 
Old 07-29-2013, 12:37 PM   #3
magpiesally
LQ Newbie
 
Registered: Jul 2013
Posts: 3

Original Poster
Rep: Reputation: Disabled
Actually, turns out I just need to create virtual network interfaces, it doesn't matter if I use aliases.

So I ran the

sudo ip li add link eth0 mac1 address 56:61:33:7c:77:db type macvlan

sudo ip li add link eth0 mac2 address 56:61:33:44:44:db type macvlan

Then I ran dhclient on each mac1 and mac2 which assigned an IP address.


Do I need to do anything else? There is stuff going on with the route tables in that link but it is a little over my head.

What I am trying to do now is just setup two virtual ethernet interfaces that can be used separately.

Thanks for your time
 
Old 07-30-2013, 01:24 AM   #4
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
I have now clue why the routing gets setup on that link. I'd say as long as you can reach all the hosts behind those two nics you will be fine.
 
Old 07-30-2013, 01:35 AM   #5
magpiesally
LQ Newbie
 
Registered: Jul 2013
Posts: 3

Original Poster
Rep: Reputation: Disabled
Yep it works as is. Macvlans solved my problem.
 
Old 07-30-2013, 02:26 AM   #6
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
Sounds good.

Please mark the thread as solved. See the "Thread Tools" at the top of the page.
 
  


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
DHCP Server Not Assigning Addresses jimsproch Linux - Server 4 07-04-2007 09:18 AM
Problem assigning multiple aliases to one interface xxloaf Linux - Networking 3 05-08-2007 07:28 PM
assigning different IP addresses in a linux machine? hegdeshashi Linux - Networking 4 01-04-2006 02:13 AM
assigning multiple device aliases to single drive cerealdaemon Linux - General 5 07-25-2005 11:55 PM
Assigning IP addresses to game server processes jader9920 Linux - Networking 3 12-28-2003 02:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:31 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
Open Source Consulting | Domain Registration