Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

netns raw on specific interface, via configuration #30

Open
almightiest opened this issue Jul 20, 2022 · 2 comments
Open

netns raw on specific interface, via configuration #30

almightiest opened this issue Jul 20, 2022 · 2 comments

Comments

@almightiest
Copy link

Is there a way (that I'm currently not able to figure out) to configure netns to simply bring in an external "eno2" ethernet device and run dhcp4 on it? Bonus to disable ipv6. All of my vlan and routing is done in hardware (switch layer 2+, router). I'm just trying to isolate certain systemctl services to a single network, which gets pretty complicated outside of netns.

Here's the script I have to run after running systemctl start netns@my_ns.service:

ip link set dev eno2 netns my_ns
chnetns my_ns sysctl net.ipv6.conf.eno2.disable_ipv6=1
ip -n my_ns link set eno2 up
ip -n my_ns link set lo up
ip netns exec my_ns dhclient eno2

Ideally this would be done as part of the service itself. I took a look inside netnsninit script but didn't see any kind of option for this. Maybe I'm just overlooking it!

@Jamesits
Copy link
Owner

Hi,

You can add your script before this line:

It is so hard to take an abstraction of how everyone use netns, so please just treat my scripts as a template and roll your own ones that fit your requirements.

@almightiest
Copy link
Author

almightiest commented Aug 1, 2022

Thank you - i'll see if i can make that change and enable it via config and submit a PR - once i find some time :-D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants