Skip to content

External veth of every Rattan instance has the same MAC and IP addresses #148

@Centaurus99

Description

@Centaurus99

// Build veth0 for left and right, which are reserved for external connection, but ignore it for now
let left_veth0 = VethPairBuilder::new()
.name(
format!("vL0-L-{rand_string}"),
format!("vL0-R-{rand_string}"),
)
.namespace(Some(left_netns.clone()), Some(rattan_netns.clone()))
.mac_addr(
[0x38, 0x7e, 0x58, 0xe7, 1, 1].into(),
[0x38, 0x7e, 0x58, 0xe7, 1, 2].into(),
)
.ip_addr(
(IpAddr::V4(Ipv4Addr::new(192, 168, 1, 1)), 32),
(IpAddr::V4(Ipv4Addr::new(192, 168, 1, 2)), 32),
)
.build()?;
let right_veth0 = VethPairBuilder::new()
.name(
format!("vR0-L-{rand_string}"),
format!("vR0-R-{rand_string}"),
)
.namespace(Some(rattan_netns.clone()), Some(right_netns.clone()))
.mac_addr(
[0x38, 0x7e, 0x58, 0xe7, 2, 2].into(),
[0x38, 0x7e, 0x58, 0xe7, 2, 1].into(),
)
.ip_addr(
(IpAddr::V4(Ipv4Addr::new(192, 168, 2, 2)), 32),
(IpAddr::V4(Ipv4Addr::new(192, 168, 2, 1)), 32),
)
.build()?;

Although the external veth currently serves no practical purpose, this behavior might lead to user confusion and complicate network configuration at runtime.

Suggestions:

  1. Similar to how other veths are constructed, generate unique MAC and IP addresses for the external veth of each instance.
  2. By default, do not create the external veth.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions