mirror of
https://github.com/apache/cloudstack.git
synced 2025-12-18 03:23:45 +01:00
This fix would work because: 1. When booting up the router, there is possible that no ip information have been set for the interface(CS would do it after confirm router is up), so the interface isn't associate with any ip, then ifconfig cannot work. We have to use ifup, this is especially true for the first router become master. 2. After booting up phase, the ip would be associated with interfaces, then we can use ifconfig to bring them up.
36 lines
1.1 KiB
Plaintext
36 lines
1.1 KiB
Plaintext
#!/bin/bash
|
|
# Licensed to the Apache Software Foundation (ASF) under one
|
|
# or more contributor license agreements. See the NOTICE file
|
|
# distributed with this work for additional information
|
|
# regarding copyright ownership. The ASF licenses this file
|
|
# to you under the Apache License, Version 2.0 (the
|
|
# "License"); you may not use this file except in compliance
|
|
# with the License. You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing,
|
|
# software distributed under the License is distributed on an
|
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
# KIND, either express or implied. See the License for the
|
|
# specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
set -e
|
|
|
|
ip link|grep BROADCAST|grep -v eth0|grep -v eth1|cut -d ":" -f 2 > /tmp/iflist
|
|
while read i
|
|
do
|
|
if [ "$i" == "eth2" ]
|
|
then
|
|
ifdown $i
|
|
ifup $i
|
|
else
|
|
ifconfig $i down
|
|
ifconfig $i up
|
|
fi
|
|
done < /tmp/iflist
|
|
ip route add default via [GATEWAY] dev eth2 && \
|
|
service cloud-passwd-srvr restart && \
|
|
service dnsmasq restart
|