在centos 7.1下安装devstack时,执行到下面的步骤时报错                                                                                                            
2015-12-11 17:07:57.779 | + ADD_DEFAULT_ROUTE='sudo ip -f inet r replace default via 192.168.141.2 dev br-ex'
2015-12-11 17:07:57.779 | + [[ True == \T\r\u\e ]]                                                          
2015-12-11 17:07:57.779 | + ADD_OVS_PORT='sudo ovs-vsctl --may-exist add-port br-ex eno33554976'            
2015-12-11 17:07:57.779 | + [[ 192.168.141.128/24 brd 192.168.141.255 != '' ]]                              
2015-12-11 17:07:57.779 | + IP_DEL='sudo ip addr del 192.168.141.128/24 brd 192.168.141.255 dev eno33554976'
2015-12-11 17:07:57.779 | + IP_ADD='sudo ip addr add 192.168.141.128/24 brd 192.168.141.255 dev br-ex'      
2015-12-11 17:07:57.779 | + sudo ip addr del 192.168.141.128/24 brd 192.168.141.255 dev eno33554976         
2015-12-11 17:07:57.787 | + sudo ip addr add 192.168.141.128/24 brd 192.168.141.255 dev br-ex               
2015-12-11 17:07:57.793 | + sudo ovs-vsctl --may-exist add-port br-ex eno33554976                           
2015-12-11 17:07:57.814 | + sudo ip -f inet r replace default via 192.168.141.2 dev br-ex                   
2015-12-11 17:07:57.821 | RTNETLINK answers: Network is unreachable        

单独执行该命令,还是报错
[root@localhost ~]# sudo ip -f inet r replace default via 192.168.141.2 dev br-ex                                                                       
RTNETLINK answers: Network is unreachable 
查看端口状态,发现br-ex 的状态为down,然后手动up该端口后,命令执行成功                                                                           
[root@localhost ~]# ip addr show                                                                                       
1: lo: mtu 65536 qdisc noqueue state UNKNOWN                                                    
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00                                                              
    inet 127.0.0.1/8 scope host lo                                                                                     
       valid_lft forever preferred_lft forever                                                                         
    inet6 ::1/128 scope host                                                                                           
       valid_lft forever preferred_lft forever                                                                         
2: eno16777736: mtu 1500 qdisc pfifo_fast state UP qlen 1000                         
    link/ether 00:0c:29:a0:aa:48 brd ff:ff:ff:ff:ff:ff                                                                 
    inet 10.0.0.150/24 brd 10.0.0.255 scope global eno16777736                                                         
       valid_lft forever preferred_lft forever                                                                         
    inet6 fe80::20c:29ff:fea0:aa48/64 scope link tentative dadfailed                                                   
       valid_lft forever preferred_lft forever                                                                         
3: eno33554976: mtu 1500 qdisc pfifo_fast master ovs-system state UP qlen 1000       
    link/ether 00:0c:29:a0:aa:52 brd ff:ff:ff:ff:ff:ff                                                                 
    inet6 fe80::20c:29ff:fea0:aa52/64 scope link                                                                       
       valid_lft forever preferred_lft forever                                                                         
4: virbr0: mtu 1500 qdisc noqueue state DOWN                                       
    link/ether 52:54:00:f7:2f:e3 brd ff:ff:ff:ff:ff:ff                                                                 
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0                                                      
       valid_lft forever preferred_lft forever                                                                         
5: virbr0-nic: mtu 1500 qdisc pfifo_fast master virbr0 state DOWN qlen 500         
    link/ether 52:54:00:f7:2f:e3 brd ff:ff:ff:ff:ff:ff                                                                 
6: ovs-system: mtu 1500 qdisc noop state DOWN                                                    
    link/ether 12:58:4a:8b:b3:5e brd ff:ff:ff:ff:ff:ff                                                                 
11: br-int: mtu 1500 qdisc noop state DOWN                                                       
    link/ether ae:bd:72:fa:c0:4a brd ff:ff:ff:ff:ff:ff                                                                 
12: br-ex: mtu 1500 qdisc noop state DOWN                                                        
    link/ether 00:0c:29:a0:aa:52 brd ff:ff:ff:ff:ff:ff                                                                 
    inet 192.168.141.128/24 brd 192.168.141.255 scope global br-
ex                                                     
       valid_lft forever preferred_lft forever      
[root@localhost ~]# ifconfig br-ex up
[stack@localhost devstack]$ sudo ip -f inet r replace default via 192.168.141.2 dev br-ex    
将ifconfig命令加入到脚本文件中                                                                                                                                                           
[root@localhost ~]# cd /home/stack/devstack/                                                                           
[root@localhost devstack]# find ./ -type f |xargs grep "ip -f inet r replace default via"                              
[root@localhost devstack]# find ./ -type f |xargs grep "ADD_DEFAULT_ROUTE"                                             
./lib/neutron-legacy:            ADD_DEFAULT_ROUTE="sudo ip -f $af r replace default via $DEFAULT_ROUTE_GW dev $to_intf"
./lib/neutron-legacy:        $IP_DEL; $IP_ADD; $ADD_OVS_PORT; $ADD_DEFAULT_ROUTE