0

I've to connect to a service running inside a runc container, I've written the below script and is able to ping the container from the host and can connect to the internet from inside the container.

But I'm unable to ping the container from another host.

bridge_setup.sh

#!/bin/bash sudo brctl addbr br0 sudo ip addr add 192.1xx.xxx.xx/24 dev br0 sudo ip link set br0 up 

net_setup.sh

bridge_name=br0 net_interface=alpine_network cont_ip=192.1xx.xxx.xx veth_host=veth_host veth_guest=veth_guest sudo ip link add $veth_host type veth peer name $veth_guest sudo ip link set $veth_host up sudo brctl addif $bridge_name $veth_host sudo ip netns add $net_interface sudo ip link set $veth_guest netns $net_interface sudo ip netns exec $net_interface ip link set $veth_guest name eth1 sudo ip netns exec $net_interface ip addr add $cont_ip/24 dev eth1 sudo ip netns exec $net_interface ip link set eth1 up ip netns exec $net_interface ip route add default via 192.168.20.1 #bridge ip as a deafult gateway sudo iptables -t nat -A POSTROUTING -s 192.1xx.xxx.xx/24 -j MASQUERADE #connecting to the internet sudo sysctl -w net.ipv4.ip_forward=1 

1 Answer 1

0

the other host has no concept of the location of that subnet.

  1. add the route to the host
  2. add the route to the default gateway of the other host
1
  • Hi, the server running is on a VM on the host from which the client will reside, and call connect, can you give the answer in command to be used for this? Commented Nov 13, 2020 at 5:33

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.