5857beeaf6
Signed-off-by: Tuan-Dat Tran <tuan-dat.tran@tudattr.dev>
20 lines
297 B
Bash
Executable File
20 lines
297 B
Bash
Executable File
#!/bin/bash
|
|
|
|
NS=$1
|
|
IF=$2
|
|
IP=$3
|
|
|
|
# Add interfaces to namespaces
|
|
ip link set "$IF" netns "$NS"
|
|
|
|
# Set IP Addresses
|
|
ip netns exec "$NS" ip addr add dev "$IF" "$IP"
|
|
|
|
# Turn on Links
|
|
ip netns exec "$NS" ip link set up "$IF"
|
|
|
|
# For Debugging
|
|
#
|
|
# # Show interface info
|
|
# ip netns exec "$NS" ip a s "$IF"
|