Created
October 11, 2025 13:16
-
-
Save s3va/92a54baef76ed0cb307c6a573824a387 to your computer and use it in GitHub Desktop.
ip network name spaces
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| sudo ip netns add tgspace | |
| sudo ip netns exec tgspace ip link set lo up | |
| sudo ip link add veth0 type veth peer name veth1 | |
| sudo ip link set veth1 netns tgspace | |
| sudo ip addr add 192.168.123.1/24 dev veth0 | |
| sudo ip link set veth0 up | |
| sudo ip netns exec tgspace ip addr add 192.168.123.2/24 dev veth1 | |
| sudo ip netns exec tgspace ip link set veth1 up | |
| sudo ip netns exec tgspace ip route add default via 192.168.123.1 | |
| #sysctl net.ipv4.ip_forward | |
| sudo iptables -t nat -A POSTROUTING -s 192.168.123.0/24 -o enp3s0 -j MASQUERADE | |
| #sudo mkdir -p /etc/netns/tgspace | |
| #echo "nameserver 8.8.8.8" | sudo tee /etc/netns/tgspace/resolv.conf | |
| #echo "127.0.0.1 myhostname" | sudo tee /etc/netns/tgspace/hosts | |
| #sudo ip netns exec tgspace openvpn --data-ciphers AES-128-CBC --config ~/vpngate/w/japan-tokio-003.ovpn | |
| # | |
| # | |
| # | |
| #sudo ip netns exec tgspace sudo -u seva ~/Telegram/Telegram | |
| #sudo ip netns exec tgspace sudo -u seva bash -c "XDG_RUNTIME_DIR=/run/user/1000 ~/Telegram/Telegram" | |
| # |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment