Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6830555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:37:55+00:00 2026-05-26T22:37:55+00:00

I have set up some virtual IPs via: ~# ip link add link eth0

  • 0

I have set up some virtual IPs via:

~# ip link add link eth0 name eth0.1 address 11:22:33:44:55:66 type macvlan
~# ifconfig eth0.1 10.10.0.0/24

I am using the following code to connect from it:

sTCP = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sTCP.setsockopt(socket.SOL_SOCKET, IN.SO_BINDTODEVICE, IFACE)
print "PORT s_TCP:" + str(HOST) +":" +str(TCP_PORT)
sTCP.connect((HOST, TCP_PORT))
print "Connected"

this works fine if IFACE is eth0, but it does not get past sTCP.connect from eth0.1 and fails in bindtodevice (as expected) on eth0.2.

Why does eth0.1 not work? Is this a python problem, or something in the linux network implementation?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:37:55+00:00Added an answer on May 26, 2026 at 10:37 pm

    I just tried this on my Fedora 13 system and it worked. I did have to make some modifications to make it work on my system, hopefully this will give you clues. Code used:

    ### in shell
    # Used 00 for first MAC octet to avoid issues with multicast addressing
    ip link add link eth0 name eth0.1 address 00:22:33:44:55:66 type macvlan
    ifconfig eth0.1 10.1.23.6/25
    
    # python
    import socket
    HOST = "10.1.23.30"
    TCP_PORT = 80
    IFACE = "eth0.1"
    sTCP = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    # switched to socket.SO_BINDTODEVICE since I'm not sure what "IN" referred to
    # EDIT: figured out there's another module called IN, but the value is the same (25)
    sTCP.setsockopt(socket.SOL_SOCKET, socket.SO_BINDTODEVICE, IFACE)
    print "PORT s_TCP:" + str(HOST) +":" +str(TCP_PORT)
    sTCP.connect((HOST, TCP_PORT))
    print "Connected"
    

    I used tcpdump to prove to myself the packets were coming out of eth0.1. Perhaps you’re running into a VLAN issue? Run packet captures on the client and server to see what’s actually happening on the wire.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Google Test Framework to set some unit tests. I have got three
I have to set some routing rules in my php application, and they should
I have a set of some classes which are all capable of being constructored
I have java script code to set some of the properties of ajax controls.
Do you have some predefined set of targets which all build.xml files you create
I have been asked to set up some authentication for some content on our
I have a set of expressions representing some formula with some parameters inside. Like:
I have a set of methods that do some utility work over SQL connection,
How can I have SQL repeat some set-based operation an arbitrary number of times
I have a set of options, some orthogonal (can be combined in any combination),

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.