Questions tagged [network-namespaces]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
0 answers
11 views

Wireguard to endpoint Inside a Namespace

I have three VM's. VM-A,VM-B & VM-X. I have a application running on the backend server VM-X. VM-A is the Main frontend server which has high capacity. VM-B is just a standby server of low ...
  • 139
0 votes
1 answer
31 views

Ubuntu 22.04 netns with veth connected to bridge unable to ping gateway

Hey guys this is probably just something stupid I'm missing, but I'm having trouble setting up a net namespace to use for my VPN. The weird part is that this script/setup was working, and has suddenly ...
1 vote
0 answers
26 views

Prevent network namespaces / lxd-bridges from talking to each other, but keep internet access?

Following goal: I have lxd containers each set of containers should have their dedicated isolated network each should still be able to connect to the internet (e.g. apt update or curl), but not leak ...
0 votes
0 answers
33 views

socat streaming UDP is slower than TCP

I'm currently using subprocess.run(["socat", f"udp-listen:{_to},fork,reuseaddr,bind=127.0.0.1", f"""exec:'sudo ip netns exec {netns} socat STDIO "UDP-connect:...
0 votes
1 answer
17 views

How can i map multiple ports in systemd-nspawn container?

I'm writing a container manager script which depends on nspawn, and the container is using a Virtual Ethernet Connection(-n opt). but it looks like that nspawn only support port mapping for single ...
1 vote
1 answer
20 views

If ports are unpriviledged, why can't I access them if I am root in a namespace?

I've run sudo sysctl -w net.ipv4.ip_unprivileged_port_start=1. However, sudo ip netns exec myvpn unshare -r python -m http.server -b 127.0.0.1 2 does not work. Strangely enough, this does: sudo ip ...
1 vote
0 answers
8 views

Advertising VXLAN learned MACs into a different namespace

I would like to run a l2 evpn (vxlan) bgp speaker in a different namespace and advertise the learned addresses into another namespace. In building the following topology, the BGP daemon populates the ...
0 votes
0 answers
17 views

Isolate only loopback interface in network namespace

I want to create some network namespaces. However, processes in that namespace can't access other interfaces (eg. can't access 1.300.200.3, which is an IP on my wireguard interface, nor can it access ...
1 vote
1 answer
165 views

Linux packet mark across network namespaces

I am trying to use iptables to packet mark packets of a certain source/destination IP in the mangle table on a given host. The packets are later forwarded to a particular network namespace on the same ...
0 votes
0 answers
209 views

How do I start a Docker container in custom network namespace?

How do I make docker run to setns to the network namespace of my choice when starting a container? I want something like --net host mode, but aiming to the namespace of Docker server itself. Or should ...
  • 5,216
2 votes
0 answers
99 views

Docker overlay network connection between containers lags simetimesin multiples of 1s

Two containers talking to each other on overlay network with high traffic (connection frequency) occasionally got connection lag almost exact multiple of 1s. It doesn't matter whether it is same host ...
  • 1,673
0 votes
1 answer
60 views

How can I copy $BASHPID in bash script?

I have a network namespace and I want to run command with this netns bash pid, how can I do it in bash script? Code example: sudo ip netns add ns1 #this is my network namespace #In separate shell I ...
  • 3
0 votes
1 answer
305 views

How to connect Linux network namespace with other VM using internal network?

I have two Virtual Machnes (VM) in Virtualbox connected with internal network. On the first one I have network namespace named n0. I want to connect this namespace to network interface and finally ...
  • 3
2 votes
1 answer
213 views

Capture DNS traffic to and from a network namespace using tshark

How can I capture traffic specifically from a network interface inside a network namespace using tshark? In my case, the network interface tun0 is moved into the network namespace called vpn. Normally ...
0 votes
0 answers
44 views

Runing libreoffice from network namespace session?

I am using Ubuntu Mate: $ echo $DESKTOP_SESSION; cat /etc/issue; uname -a; mate Ubuntu 20.04.4 LTS \n \l Linux mypc 5.4.0-104-generic #118-Ubuntu SMP Wed Mar 2 19:02:41 UTC 2022 x86_64 x86_64 x86_64 ...
  • 6,346
3 votes
1 answer
266 views

IPv6 forwarding doesn't work in a network namespace

I have 3 Linux VMs connected like this: / server1 \ | ens19 2001:1::2 | \ / | / \ | ens19 2001:1::1 | | ...
  • 33
0 votes
1 answer
192 views

Can't access directory from netns

I created a simple test netns : sudo ip netns add test Then I brought up the lo interface. I'm currently in the home directory of user1, and by executing sudo ip netns exec test ls -la I see all the ...
  • 1
2 votes
2 answers
117 views

Is cgroup a type of namespace?

Is cgroup a type of namespace? I am asking this because I have seen blogs talking as if cgroup and namespaces are different. However, in different linux commands , cgroup is considered as a type of ...
  • 1,642
2 votes
1 answer
342 views

How can I use a bind mount in a network namespace?

I have an app I run in a network namespace. This works well. I want to run the app multiple times, in different namespaces. For convenience, I want to bind mount the app's working directory to ...
  • 175
0 votes
0 answers
304 views

Bridging between network namespaces using tun or tap devices

I am trying to create two tap interfaces which are connected via a userspace program which should be able to see (and later modify) all packets going over the "wire". While this works when I ...
-1 votes
1 answer
269 views

To persist a namespace, create a bind mount point on which /proc/PID?

From https://man7.org/linux/man-pages/man1/n.1.html : By default, a new namespace remains in existence only as long as it has at least one member process. A namespace can be made persistent— that ...
1 vote
1 answer
468 views

Can't establish communication between two network namespaces using bridge network

I'm following this video about network namespaces in Linux, and trying to practice it myself, but for some reason it doesn't work. What I've done is: After creating 2 network namespaces named "...
  • 264
0 votes
1 answer
112 views

How to use VXLAN to connect netns under multiple subnets like K8S's Flannel?

I have used $ ip link add vxlan0 type vxlan \ id 42 \ dstport 4789 \ group 239.1.1.1 \ dev enp0s8 and $ ip link add vxlan0 type vxlan \ id 42 \ dstport 4789 \ ...
  • 1
1 vote
1 answer
596 views

How to move interface into nonstandard network namespace as unprivileged user

I have a Linux network namespace bind mounted at ~/mynamespace as follows: unshare -mrn; touch ~/mynamespace; # executed in the console opened by the first command unshare --net=~/mynamespace true; # ...
0 votes
1 answer
512 views

IP forwarding in linux namespaces

I am currently trying to simulate a network using network namespaces under Linux. I have already set up the nodes and connected them, and they can ping each other, one hop at a time. But I am really ...
2 votes
1 answer
328 views

How to setup veth with 9000 MTU to simulate sending and receiving large UDP multicast packets on the same host?

The sender needs to transmit large data packets to the receiver (which is on the same host with 1500 MTU) and I think this can be simulated using veth with 9000 MTU, from my reading on it. But I'm not ...
  • 23
0 votes
1 answer
188 views

ip netns exec cannot start ONLY mate-terminal and gnome-terminal?

I am using the newns script from here: https://superuser.com/questions/983727/route-only-specific-traffic-through-vpn ... except on this system: $ mate-about -v MATE Desktop Environment 1.24.0 $ cat /...
  • 6,346
0 votes
0 answers
105 views

Connect namespace to internet using Second public ip address

I have an Ubuntu18 server with Two public addresses How can i create a namespace and connect to the internet through the second public ip? (need to launch a program and force it to use the second ip ...
1 vote
1 answer
290 views

How to set up stateless NAT for two UDP connections from a global network to special network namespace?

There is the requirement to set up a stateless NAT for two UDP connections from a physical network adapter in global network namespace via a linked pair of virtual network adapters to a service ...
  • 111
2 votes
2 answers
300 views

Network namespace & slirp4netns - access namespaced network from host

I create a network namespace using unshare --map-root-user --net --mount --keep-caps "do_stuff". I connect the namespace to the internet using slirp4netns --configure --mtu=65520 $ns-id tap0....
  • 297
2 votes
1 answer
231 views

Network namespace doesn't work with vpn

I have created a network namespace (named ppn) to run certain application in it. This works perfectly but when my commercial VPN (based on OpenVPN) is also enabled it seems that the traffic is only ...
3 votes
0 answers
1k views

Can systemd-networkd handle interfaces in network namespace?

I'm trying to configure systemd-networkd on an embedded system where wlan0 is in a separate network namespace. I'd like for systemd to configure and monitor the interaface so that related services ...
3 votes
2 answers
747 views

How to share wireguard with namespace?

I have a wireguard connection (interface name wg0) to a trusted machine inside an admin network at $DAYJOB. Usually, I don't want to use wg0 for all my traffic, only for IP addresses in the 172.16.0.0/...
  • 1,181
2 votes
1 answer
467 views

How to assign a name to the existing anonymous network namespace

I have a Linux process that creates a network namespace without registering it in /run/netns. The process has also own PID namespace. The network namespace does not have a name and I can see only id ...
0 votes
1 answer
347 views

How can I access a local network namespace from an external node?

I am trying to set up a runc container running mongoDB Enterprise Edition v4.4 on an EC2 Ubuntu x86 20.04 node, kernel v5.10. I am using the following to set up a network namespace for the container: ...
1 vote
2 answers
2k views

Pipe multiple commands to socat reverse shell (network-namespaced)

I have a bash script that: does some thing connects/opens a reverse shell. does another thing my-script contents: #!/usr/bin/env bash # does 'some thing' sudo /usr/bin/nsenter --setuid 1000 --...
  • 121
0 votes
1 answer
258 views

Injected TCP/UDP packets ignored by the linux kernel on virtual eth

I try to create a local testing setup for a DPDK forwarding app, using network namespaces. The setup I created looks like this: veth0(10.0.0.1, namespace vnet0) <> veth1(no ip, host) <-DPDK ...
  • 101
3 votes
1 answer
374 views

Create additional IP address in a separate network namespace

I'm running Ubuntu 18.04, Linux kernel 5.4.0. My laptop has local IP address 192.168.0.130: $ sudo ip addr show dev wlp2s0 3: wlp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue ...
  • 951
2 votes
1 answer
938 views

Access localhost from network namespace

I've followed this guide to setup a network namespace (to run VPN in). Here's my setup script: ip netns add myns ip link add type veth ip link set veth1 netns myns ip addr add 10.255.255.1/24 dev ...
  • 297
1 vote
0 answers
162 views

Error: Connection activation failed: Failed to find a compatible device for this connection

Hi linux newbie here pardon any mistakes. I have configured a network namespace local-routeTable and have brought up interface eth3 inside the namespace: # ip netns exec local-routeTable ifconfig eth3:...
  • 11
4 votes
1 answer
391 views

ping inside netns requires sudo (Fedora)

Using fedora 32, I launched a shell inside a network namespace using sudo ip netns add net0 sudo ip netns exec net0 sudo -u fred /usr/bin/bash I configured the network links and firewall to enable ...
1 vote
0 answers
177 views

how to create FTP server in namespace

Lets say i created two namespace in Ubuntu. ip netns add A ip netns add B now create Macvlan corresponding to each namespaces ip link add macvlanA link wlo1 type macvlan mode bridge ip link set ...
  • 11
1 vote
1 answer
500 views

How to make a namespace visible inside a chrooted/NEWPID process

I create a new process using CLONE_NEWPID and chroot to /mnt/ Outside of that, I create a new netns using the ip netns command. e.g. ip netns add test1 Any idea how can I make the chrooted process, ...
  • 11
5 votes
0 answers
391 views

Why does a network interface lose its IP address when moved to a different network namespace?

Suppose I use ip-link(8) to create an interface, test-macvlan, and assign it the address 10.11.12.13: # ip link add link eno1 name test-macvlan type macvlan # ip address add 10.11.12.13 dev test-...
  • 766
2 votes
1 answer
335 views

access /proc/net/stats of other namespace

Is there a way that an application can access the /proc/net/stat from another namespace? The obvious thing to do would be to put the application, i.e, process in that netns, however, this application ...
  • 679
1 vote
1 answer
1k views

Network namespace as a regular user

In linux you can create network namespaces, using the ip command. But you need to be root to run that command. However you can still create network namespaces as a regular user using unshare -rUn. ...
0 votes
1 answer
566 views

Linux networking: Split eth0 (w/multiple ipv4) giving each ipv4 its own virtualdevice and namespace

I am trying to build a little project using Linux network namespaces, but am a bit overwhelmed by all the linux networking features and containerization-tech available, and thus unsure if i'm ...
  • 103
0 votes
1 answer
1k views

ifup, ifdown get interface state wrong when using network namespaces, in Ubuntu and Raspbian

I create several network namespaces with ip netns add ns1, ip netns add ns1. When I try to start/stop network interfaces inside network namespaces with ifup and ifdown the interface state is wrong: $...
  • 617
1 vote
1 answer
2k views

tcpdump traffic in network namespaces in `net=host` dockercontainer

I am trying to capture a tcpdump of a set of processes running in the mininet network emulation framework. Mininet works by putting each process/set of processes into its own network namespace and ...
  • 177
0 votes
1 answer
927 views

Unable to ping external network from namespace, probably postrouting not working

I'm trying to ping an external ip (in this case google) from inside a network namespace. ip netns add ns1 # Create v-eth1 and v-peer1: v-eth1 is in the host space whereas peer-1 is supposed to be ...