Skip to content

Instantly share code, notes, and snippets.

@Pristavkin
Created August 3, 2019 07:22
Show Gist options
  • Save Pristavkin/494a86503f44ed3f4d68f6bc85f8fc3f to your computer and use it in GitHub Desktop.
Save Pristavkin/494a86503f44ed3f4d68f6bc85f8fc3f to your computer and use it in GitHub Desktop.
RHEL/CentOS move eth to bridge
#!/bin/sh
export MAIN_CONN=enp5s0f0
bash -x <<EOS
systemctl stop libvirtd
nmcli c delete "$MAIN_CONN"
nmcli c delete "Wired connection 1"
nmcli c add type bridge ifname br0 autoconnect yes con-name br0 stp off
#nmcli c modify br0 ipv4.addresses 192.168.1.99/24 ipv4.method manual
#nmcli c modify br0 ipv4.gateway 192.168.1.1
#nmcli c modify br0 ipv4.dns 192.168.1.1
nmcli c add type bridge-slave autoconnect yes con-name "$MAIN_CONN" ifname "$MAIN_CONN" master br0
systemctl restart NetworkManager
systemctl start libvirtd
systemctl enable libvirtd
EOS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment