Created
April 25, 2023 01:40
-
-
Save akdev1l/8de01f6689a912027b085c6223db5ba0 to your computer and use it in GitHub Desktop.
This file contains 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 | |
main() { | |
IFace="${1}" | |
MainIP="${2}" | |
DNSList="${3}" | |
BRIFace="${IFace}br" | |
nmcli conn delete "System ${IFace}" | |
nmcli conn add \ | |
type bridge \ | |
ifname "${BRIFace}" \ | |
autoconnect yes \ | |
con-name "${BRIFace}" \ | |
stp off | |
nmcli conn modify "${BRIFace}" \ | |
ipv4.addresses "${MainIP}/24" \ | |
ipv4.gateway "${MainGateway}" \ | |
ipv4.dns "${DNSList}" \ | |
ipv4.method manual | |
nmcli conn add \ | |
type bridge-slave \ | |
autoconnect yes \ | |
con-name "${IFace}" \ | |
ifname "${IFace}" \ | |
master "${BRIFace}" | |
nmcli conn up "${BRIFace}" | |
} | |
main "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment