Questions tagged [network-namespaces]
The network-namespaces tag has no usage guidance.
135
questions
0
votes
0
answers
36
views
How to firewall a network namespace using firewalld?
I'm running fedora 36 using firewalld as my firewall.
I set up a network namespace called "wireguard". It contains the interface wg0 which connects to Mullvad VPN. I set it up like this:
ip ...
1
vote
1
answer
40
views
What is the difference between using Linux VRF, network namespaces and using different routing tables?
The ip-vrf manual reads :
A VRF provides traffic isolation at layer 3 for routing, similar to how a VLAN is used to isolate traffic at layer 2. Fundamentally, a VRF is a separate routing table.
At ...
0
votes
0
answers
86
views
Forward traffic from public IP to namespace
I have two VMs VM-A & VM-B connected via IPIP Tunnel in a namespace. I want the application in VM-B which is under namespace to be accessed from the public IP of VM-C. Can someone help me how can ...
0
votes
0
answers
135
views
Can systemd-resolved provide DNS service to multiple network namespaces?
Can systemd-resolved provide DNS service to multiple network namespaces? If yes, then how?
Running on Ubuntu 22.04, I've created a network namespace named foo. I've created and configured an ipvlan ...
1
vote
0
answers
68
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 ...
0
votes
1
answer
245
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
68
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
186
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
58
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
58
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
12
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
30
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 ...
2
votes
1
answer
425
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
463
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 ...
2
votes
0
answers
235
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 ...
0
votes
1
answer
73
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 ...
0
votes
1
answer
571
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 ...
2
votes
1
answer
529
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
100
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 ...
3
votes
1
answer
599
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 |
| ...
0
votes
1
answer
431
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 ...
2
votes
2
answers
259
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 ...
2
votes
1
answer
798
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 ...
0
votes
0
answers
567
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 ...
0
votes
1
answer
499
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
752
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 "...
0
votes
1
answer
186
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
vote
1
answer
1k
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; # ...
1
vote
1
answer
773
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
519
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 ...
0
votes
1
answer
228
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 /...
0
votes
0
answers
124
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
499
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 ...
2
votes
2
answers
607
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....
2
votes
1
answer
344
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
2k
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
935
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/...
2
votes
1
answer
651
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
515
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 --...
0
votes
1
answer
377
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 ...
4
votes
1
answer
645
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 ...
3
votes
1
answer
1k
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 ...
1
vote
0
answers
292
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:...
4
votes
1
answer
539
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
214
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 ...
1
vote
1
answer
626
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, ...
5
votes
0
answers
535
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-...
2
votes
1
answer
481
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 ...
1
vote
1
answer
2k
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. ...