Monthly Archives: March 2015

linux comment line which start with some string

sed s/^character-set-server=utf8/#character-set-server=utf8/’ -i /etc/my.cnf

If you want comment on this this line “character-set-server=utf8” on all your servers, you should use something like ansible:

ansible mysql_servers -m shell -a “sed -e ‘s/^character-set-server=utf8/#character-set-server=utf8/’ -i /etc/my.cnf”

networkmanager cli create bridge

To create a bridge, named bridge-br0, issue a command as follows as root:
nmcli con add type bridge ifname br0

Connection ‘bridge-br0’ (6ad5bba6-98a0-4f20-839d-c997ba7668ad) successfully added.
If no interface name is specified, the name will default to bridge, bridge-1, bridge-2, and so on.
To view the connections, issue the following command:

nmcli con show
NAME UUID TYPE DEVICE
bridge-br0 79cf6a3e-0310-4a78-b759-bda1cc3eef8d bridge br0
eth0 4d5c449a-a6c5-451c-8206-3c9a4ec88bca 802-3-ethernet eth0
Spanning tree protocol (STP) is enabled by default. The values used are from the IEEE 802.1D-1998 standard. To disable STP for this bridge, issue a command as follows as root:

nmcli con modify bridge-br0 bridge.stp no
To re-enable 802.1D STP for this bridge, issue a command as follows as root:
nmcli con modify bridge-br0 bridge.stp yes
The default bridge priority for 802.1D STP is 32768. The lower number is preferred in root bridge selection. For example, a bridge with priority of 28672 would be selected as the root bridge in preference to a bridge with priority value of 32768 (the default). To create a bridge with a non-default value, issue a command as follows:
nmcli con add type bridge ifname br5 stp yes priority 28672

Connection ‘bridge-br5’ (86b83ad3-b466-4795-aeb6-4a66eb1856c7) successfully added.
The allowed values are in the range 0 to 65535.
To change the bridge priority of an existing bridge to a non-default value, issue a command in the following format:
nmcli connection modify bridge-br5 bridge.priority 36864

The allowed values are in the range 0 to 65535.
To view the bridge settings, issue the following command:
nmcli -f bridge con show bridge-br0

Further options for 802.1D STP are listed in the bridge section of the nmcli(1) man page.
To add, or enslave an interface, for example eth1, to the bridge bridge-br0, issue a command as follows:
nmcli con add type bridge-slave ifname eth1 master bridge-br0
Connection ‘bridge-slave-eth1’ (70ffae80-7428-4d9c-8cbd-2e35de72476e) successfully added.
At time of writing, nmcli only supports Ethernet slaves.

To change a value using interactive mode, issue the following command:
nmcli connection edit bridge-br0
You will be placed at the nmcli prompt.
nmcli> set bridge.priority 4096
nmcli> save
Connection ‘bridge-br0’ (79cf6a3e-0310-4a78-b759-bda1cc3eef8d) successfully saved.
nmcli> quit