Compare commits
2 Commits
494620210e
...
bcf9563649
Author | SHA1 | Date | |
---|---|---|---|
bcf9563649 | |||
|
81f5848f37 |
22
add_vlan.sh
Executable file
22
add_vlan.sh
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
if [[ $UID != 0 ]]; then
|
||||||
|
echo "You need to be root to execute that script"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $# != 2 ]]; then
|
||||||
|
echo "You need to give at least 2 parameters <network_interface> <vlan_id>."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
apt install vlan
|
||||||
|
modprobe 8021q
|
||||||
|
ip link add link $1 name $1.$2 type vlan id $2
|
||||||
|
if [[ $2 == 10 ]]; then
|
||||||
|
ip addr add 192.168.0.217/24 dev $1.$2
|
||||||
|
else
|
||||||
|
ip addr add 192.168.$2.217/24 dev $1.$2
|
||||||
|
fi
|
||||||
|
ip link set up $1.$2
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user