Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [network-namespaces]

The tag has no usage guidance.

1
vote
1answer
30 views

dnsmasq running in namespace can't take queries from within namespace

I've set up a default dnsmasq.conf with essentially no modifications except: listen-address=192.168.42.2 interface=veth1 # Also tried without server=8.8.8.8 And my /etc/hosts looks like this: 127.0....
0
votes
1answer
44 views

Is it possible to send packets between network namespaces using only TUN/TAP interfaces?

I am trying to understand the difference between different types of (virtual) interfaces (e.g. TUN/TAP, veth etc.) and was studying some of these types within the context of containers. Is it ...
0
votes
1answer
77 views

Can I lock down access to a TCP port in Linux

I'm trying to secure a single-node Elasticsearch machine. Basically, I want to put Elasticsearch behind a reverse proxy (nginx) and make sure that the only way any user or process can communicate with ...
3
votes
1answer
83 views

firejail : only let a program access localhost

I have this local network service and this client program needing to access it. I am running them both as an unprivileged user. I am looking for a way to sandbox the client using firejail, in a way ...
0
votes
0answers
40 views

Can I assign a virtual interface of wireless to a network namespace?

I am trying to make a VPN router while keeping the host itself accessing Internet without VPN. The host has only one NIC which is wireless. So I have added two virtual interfaces via iw phy phy0 ...
0
votes
1answer
37 views

How to Keep Network Namespace after reboot

I have created a network namespace, but after I have reboot, it've been removed. I don't found an answer at this problem on the internet, so this is why I'm asking you : Is there a way to keep a ...
0
votes
0answers
92 views

How to run ip netns exec without password?

I'm on arch and am using a network namespace wiredlan for ethernet, using it for LAN based applications and big downloads. I run commands/apps on the netns as: alias runonlan='sudo ip netns exec ...
2
votes
1answer
212 views

Switching into a network namespace does not change /sys/class/net?

The Linux man page for network namespaces(7) says: Network namespaces provide isolation of the system resources associated with networking: [...], the /sys/class/net directory, [...]. However, ...
0
votes
0answers
26 views

Linux processes without certain namespaces?

When chromium is running I see processes in /proc/[PID]/ where some of the namespace links inside /proc/[PID]/ns/do link to nothing, that is, they cannot be readlinked and return errors instead. Also ...
1
vote
1answer
238 views

Move network device between Linux network namespaces

In Linux, set up 2 network namespaces, ns1 and ns2. "ip netns list" can view the 2 network namespaces. Move one network device from Linux root namespace to ns1 then from ns1 to ns2, then delete ns2, ...
1
vote
0answers
98 views

iptables-save behaviour in network namespace in linux

My setup: Linux 4.16.13-2-ARCH iproute2 4.16.0-1 iptables 1.6.2-2 Issue: Output of iptables-save is empty inside network namespace. If iptables -L called before, iptables-save provides correct ...
3
votes
2answers
376 views

Separate DNS configuration in each network namespace

I've set up several network namespaces on my Linux system (kernel version 3.10), and now I want to configure each network namespace to have its own DNS settings. I created resolv.conf files in each /...
1
vote
1answer
74 views

Access /proc/pid/ns/net without running query process as root?

In a program I'm enumerating network namespaces by scanning /proc/pid/ for ns/net links. This program runs inside the "root" namespaces (original init) of the host itself. Normally, I need to run the ...
3
votes
2answers
2k views

How to find the network namespace of a veth peer ifindex?

Task I need to unambiguously and without "holistic" guessing find the peer network interface of a veth end in another network namespace. Theory ./. Reality Albeit a lot of documentation and also ...
0
votes
0answers
20 views

How can get PID for a network namespace on ubuntu 14.04? [duplicate]

Can anyone help me to find out PID for a network namespace on ubuntu 14.04? thanks in advance.
0
votes
0answers
125 views

Creating an exact copy of a whole process?

fork() forks a process, but it will not copy all of its threads; nor will it create a clone of all its fds: the fds are shared between parent and child. I want a way of do a complete fork. So after I ...
1
vote
1answer
60 views

network namespace broken after exiting openvpn

I did these: ip netns add vpn ip netns exec vpn ip addr add 127.0.0.1/8 dev lo ip netns exec vpn ip link set lo up ip link add vpn0 type veth peer name vpn1 ip link set vpn0 up ip link set vpn1 ...
4
votes
1answer
3k views

Connecting two network namespaces via a veth interface pair where each endpoint has the same name

Is there a single (simple) command that will create a veth interface pair and assign each interface to a different network namespace? For example, suppose that I have two namespaces: mynamespace-1 ...
1
vote
2answers
791 views

Internet connectivity using linux network namespace

I experimenting with Linux namespaces on Ubuntu 17.1 distro. Ultimate goal is to force an application to use a particular network interface via a 3G modem not the intranet wired connection. My PC has ...
1
vote
0answers
64 views

Limit network interface to specific commands vice versa

I'm using this tutorial: Bind unix program to specific network interface Assume that $NS and $IN is set properly My problem I have two network interfaces and one of them has data limits and I don't ...
1
vote
0answers
148 views

stp is not working in network namespaces?

Why does the Linux bridge inside of netns sees bpdus but doesn't update topology? I've created a pair of netnses: NS300, NS301, a bridge in each one: br300, br301, a first veth link between the ...
2
votes
2answers
1k views

How to make reachable macvlan aliases in a different namespaces?

I have an interface, name eth0, in my main network namespace another interface, name jail0, in an alternate network namespace (name name0). This namespace is used by a jailed environment. jail0 is a ...
0
votes
1answer
185 views

NFS mount over network namespaces

Is it possible to use NFS over Linux network namespaces? Does it even make sense? The only related thing in kernel source I found is is commit 7e3fcf61abde nfs: don't share mounts between network ...
2
votes
2answers
1k views

How do I connect a veth device inside an 'anonymous' network namespace to one outside?

I have a process that has called unshare to create a new network namespace with just itself inside. When it calls execve to launch bash, the ip command shows that I have just an lo device. If I also ...
3
votes
1answer
2k views

How to forward traffic between Linux network namespaces?

I was able to set up a network namespace and start a server that listens on 127.0.0.1 inside the namespace: # ip netns add vpn # ip netns exec vpn ip link set dev lo up # ip netns exec vpn nc -l -s ...
1
vote
1answer
433 views

SNAT to unroutable interface

I set up a virtual ethernet (veth) pair between default namespace and another namespace named RoutableNS as follow: -------------- -------------- - veth0 - -------------- veth1 ...
3
votes
0answers
297 views

dnsmasq not available from network namespace at first

ubuntu 16.04, dnsmasq 2.75 NOTE: I have dnsmasq running with --hostsdir option so dnsmasq should pick up host entries written to that directory. Steps to reproduce: ... fresh machine boot ... $> ...
1
vote
1answer
82 views

Prevent application from using all IPs on port (0.0.0.0:34964)

I have two applications that use the same port for network communication (34964). I have control over (source code) the first application and it uses 192.168.0.4:34964. Whereas the other application ...
1
vote
1answer
656 views

Default kernel parameters on new network namespaces

What are the default kernel parameters, when creating a new network namespace? Is there a way to override them upon creation? I think they are inherited by the parent process. An example using ...
-2
votes
1answer
262 views

One public IP address per Namespace [closed]

How can I associate one public IP address per Namespace in my Ubuntu 14.04 server? I need to launch one specific process per Namespace then per public IP address. I want to do that: configuration: ...
1
vote
1answer
148 views

Network Namespace (non) Isolation?

I've been doing some research on Linux and networks in general, and came across namespaces. After reading articles and learning how to set one up, I am confused. I installed an application on my ...
1
vote
1answer
63 views

Networking issue communicating to Virtual Network on ubuntu 16.04

Using ubuntu 16.04. My goal is to run a small service inside of a network namespace(my-network) and communicate with that service from the host. I have created a linux bridge, a new network ...
0
votes
1answer
352 views

Network namespaces and scripts seem to break $PATH [duplicate]

Assume the following script: $ cat test.sh #!/bin/bash echo $PATH This happens: $ echo $PATH /usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/<user>/.local/bin:/home/<user>/bin $ ...
2
votes
2answers
1k views

Can OpenVPN create the default route if it doesn't exist?

Note This question was originally asked about OpenVPN not setting a default gateway if one did not already exist even if you specify --redirect-gateway local or --redirect-gateway def1. As of 2.4.1, ...
1
vote
1answer
972 views

How to specify a namespace when creating a tun/tap device?

On linux I can create a new tun/tap device in C using something like: int fd = open("/dev/net/tun", O_RDWR); ioctl(fd, TUNSETIFF, (void *)&ifr); This will create a new network interface in the ...
1
vote
1answer
467 views

Why remount of /proc/sys is not global or does not persist in network namespace inside LXC

I have host running RHEL-7.2. Inside that running LXC. Inside LXC creating network namespaces. Inside the namespace changing sysctl variables was failing (as root): $ ip netns add testns $ ip netns ...
4
votes
1answer
4k views

routing between linux namespaces

I have the following network topology using linux namespaces: .--------.veth0 .--------.veth2 .--------. | ns_snd |------------| ns_mid |------------| ns_rcv | '--------' veth1'-----...
1
vote
1answer
32 views

linux - context-based access control

I would like to further restrict network traffic based on the source / destination application. To do that, I'm using network namespaces, but is there a better / simpler approach? My approach ...
2
votes
2answers
1k views

remove link from Linux namespace

I created a namespace in Linux with 'ip netns add foo', created a pair of veth interfaces and moved one in the namespace. I set up IP addresses etc., so that now I can ping my 'foo' namespace from the ...
2
votes
0answers
766 views

Netlink access inside a network namespace

I'm trying set up an IPsec gateway (strongSwan) on a Raspberry Pi 2. The Pi was already providing a number of services on the LAN using a private IP address. My initial attempt to turn it into an ...
4
votes
0answers
422 views

How can I constrain a user application to always run in a particular network namespace?

I need to be able to constrain a user application to always run in a particular network namespace. Assume I have previously set up my network configuration as such: ip tuntap add name tap0 mode tap ...
1
vote
2answers
238 views

Starting isolated namespace inside network namespace

I've managed to create two network namespaces (ns1 and ns2) and connect them via veth connection. They can ping each other fine, and even ssh one into another (provided I started sshd). What I would ...
12
votes
4answers
5k views

port forwarding to application in network namespace with vpn

I was able to set up a network namespace, establish a tunnel with openvpn and start an application that uses this tunnel inside the namespace. So far so good, but this application can be accessed via ...
0
votes
1answer
400 views

How to add ovs interface back to init namespace from custom one?

Am creating an internal interface tap1 in ovs & add it to a custom namespace ns1. ip netns add ns1 ovs-vsctl --may-exist add-port br0 tap1 ip link set tap1 netns ns1 after am done using the ...
6
votes
2answers
1k views

Network namespace, ssh, X11

I connect (via ssh -Y ...) from a machine (=client) to another machine (=server, actually in my LAN, but it is irrelevant); then I start a new network namespace (NNS, for short) on the server, I start ...
4
votes
1answer
474 views

Dnsmasq problem with Linux network namespace

I have tried to use dnsmasq as the name server for virtual machines. On all the vm-s, /etc/resolv.conf indicates the vm need to access 192.168.15.3 to resolve the domain names. However, the interface ...
20
votes
2answers
3k views

What script could allow regular users to use network namespaces?

I have an architecture using network namespaces (netns). I would like to allow regular users to do some operations in these netns. I could write a script netns-exec.sh, inspired by this post, ...
1
vote
1answer
428 views

Access display from network namespace

I have several network namespaces in my Fedora 21 VM. How can I access display from whithin the network namespace? # ip netns exec n1 xlogo Error: Can't open display: localhost:10.0
1
vote
1answer
770 views

Virtual NIC's in Linux?

How do I create a VNIC interface in linux? What I want to do is create an interface that is linked in some way to a physical interface but functions in its own namespace. I know the physical ...
2
votes
1answer
815 views

How to avoid duplicate connection names? (32) Connection 'Auto Ethernet' is already active on enpXXX

Is there any way that I can make networkmanager to assign some unique names or device derrived name instead of Auto Ethernet so that we can avoid the names conflict? After I've upgraded to Ubuntu ...