for i in range(lenLi):
sys.stdout.write('\r')
sys.stdout.write("[%-30s] %d%%" % ('='*i, i))
sys.stdout.flush()
part = float(i)/(lenLi-1)
symbols_num = int(30 * part)
for i in range(1, lenLi):
sys.stdout.write('\r')
part = float(i)/(lenLi-1)
symbols_num = int(30 * part)
sys.stdout.write("[%-30s] %3.2f%%" % ('='*symbols_num, part*100))
sys.stdout.flush()
for x in li:
. Но, для правильного отображения прогресс-бара, вам необходимо считать номер шага. Для это можно либо завести переменную, которая будет считать шаги, либо использовать функцию enumerate:for step_number, x in enumerate(li):
for step_number, x in enumerate(li, 1):
cat /etc/pf.conf
set limit states 128000
set optimization aggressive
#Интерфейсы на каналы, если есть алиасы можно задать IP
ext_if1="vlan100" #Kanal1
ext_if2="vlan200" #Kanal2
#Шлюз для каждого канала
ext_gw1="192.168.88.1"
ext_gw2="192.168.89.1"
#На какие адреса мы не будем nat'ить.
table <no_nat> const { 192.168.0.0/16 10.0.0.0/16 }
#Нормализуем трафик
scrub in all
#Натим поочередно пользователей через каждый из каналов.
nat from 10.0.0.0/20 to !<no_nat> -> { ($ext_if1) ($ext_if2) } round-robin sticky-address
pass out on $ext_if1 route-to ($ext_if2 $ext_gw2) from $ext_if2 to !<no_nat>
pass out on $ext_if2 route-to ($ext_if1 $ext_gw1) from $ext_if1 to !<no_nat>
sysctl -w net.ipv4.ip_forward=0
echo 0 > /proc/sys/net/ipv4/ip_forward
sysctl -p /etc/sysctl.conf && service network restart
Router#ping 192.168.0.35
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.0.35, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/1 ms
Router(config)#do ip bgp
ip bgp
^
% Invalid input detected at '^' marker.
Router(config)#do sh ip bgp
BGP table version is 71, local router ID is 100.0.0.17
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 104.0.0.0/24 117.0.0.2 0 0 0 108 109 104 i
* 105.0.0.0/24 117.0.0.2 0 0 0 108 109 105 i
*> 108.0.0.0/24 117.0.0.2 0 0 0 108 i
*> 109.0.0.0/24 117.0.0.2 0 0 0 108 109 i
*> 116.0.0.0/24 117.0.0.2 0 0 0 108 109 104 120 116 i
* 116.1.0.0/24 117.0.0.2 0 0 0 108 109 104 120 116 i
*> 117.0.0.0/24 0.0.0.0 0 0 32768 i
*> 120.0.0.0/24 117.0.0.2 0 0 0 108 109 104 120 i
*> 192.168.0.0/23 117.0.0.2 0 0 0 108 109 104 120 i
Router(config)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to down
%BGP-5-ADJCHANGE: neighbor 117.0.0.2 Down Interface flap
%BGP-5-ADJCHANGE: neighbor 116.1.0.1 Up
%BGP-5-ADJCHANGE: neighbor 105.0.0.1 Up
Router(config)#do sh ip bgp
BGP table version is 87, local router ID is 100.0.0.17
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 104.0.0.0/24 116.1.0.1 0 0 0 116 120 104 i
* 105.0.0.1 0 0 0 105 109 104 i
* 105.0.0.0/24 116.1.0.1 0 0 0 116 120 104 109 105 i
* 105.0.0.1 0 0 0 105 i
* 108.0.0.0/24 116.1.0.1 0 0 0 116 120 104 109 108 i
*> 105.0.0.1 0 0 0 105 109 108 i
* 109.0.0.0/24 116.1.0.1 0 0 0 116 120 104 109 i
*> 105.0.0.1 0 0 0 105 109 i
*> 116.0.0.0/24 116.1.0.1 0 0 0 116 i
* 105.0.0.1 0 0 0 105 109 104 120 116 i
* 116.1.0.0/24 116.1.0.1 0 0 0 116 i
* 105.0.0.1 0 0 0 105 109 104 120 116 i
*> 117.0.0.0/24 0.0.0.0 0 0 0 117 i
*> 120.0.0.0/24 116.1.0.1 0 0 0 116 120 i
* 105.0.0.1 0 0 0 105 109 104 120 i
*> 192.168.0.0/23 116.1.0.1 0 0 0 116 120 i
* 105.0.0.1 0 0 0 105 109 104 120 i
Router(config)#do sh run
Building configuration...
Current configuration : 1065 bytes
!
version 15.1
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Router
!
!
!
!
!
!
ip cef
no ipv6 cef
!
!
!
!
license udi pid CISCO2911/K9 sn FTX152410ZM
!
!
!
!
!
!
!
!
!
!
!
spanning-tree mode pvst
!
!
!
!
!
!
interface Loopback0
ip address 100.0.0.17 255.255.255.255
!
interface GigabitEthernet0/0
ip address 117.0.0.1 255.255.255.252
duplex auto
speed auto
!
interface GigabitEthernet0/1
ip address 105.0.0.2 255.255.255.252
duplex auto
speed auto
!
interface GigabitEthernet0/2
ip address 116.1.0.2 255.255.255.252
duplex auto
speed auto
!
interface Vlan1
no ip address
shutdown
!
router bgp 117
bgp log-neighbor-changes
no synchronization
neighbor 117.0.0.2 remote-as 108
neighbor 105.0.0.1 remote-as 105
neighbor 116.1.0.1 remote-as 116
network 100.0.0.0 mask 255.255.254.0
network 117.0.0.0 mask 255.255.255.0
!
ip classless
ip route 117.0.0.0 255.255.255.0 Null0
!
ip flow-export version 9
!
!
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
login
!
!
!
end
Router(config)#
ip route 192.168.0.0 255.255.254.0 FastEthernet1/0