Skip to content

Instantly share code, notes, and snippets.

@akdev1l
Created April 25, 2023 01:40
Show Gist options
  • Save akdev1l/8de01f6689a912027b085c6223db5ba0 to your computer and use it in GitHub Desktop.
Save akdev1l/8de01f6689a912027b085c6223db5ba0 to your computer and use it in GitHub Desktop.
#!/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