Журнал лабораторных работ

Содержание

Журнал

Среда (06/03/09)

/dev/pts/14
20:21:52
#ifdown eth0.215
ifdown: interface eth0.215 not configured
20:22:04
#ifup eth0.215
Ignoring unknown interface eth0.215=eth0.215.
/dev/pts/0
20:22:06
#ssh 192.168.202.1
Connection to 192.168.202.1 closed by remote host.
/dev/pts/14
20:22:10
#ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:1e:8c:64:2c:4a
          inet addr:192.168.15.9  Bcast:192.168.15.255  Mask:255.255.255.0
          inet6 addr: fe80::21e:8cff:fe64:2c4a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:75777 errors:0 dropped:0 overruns:0 frame:0
          TX packets:64434 errors:0 dropped:0 overruns:0 carrier:2
          collisions:0 txqueuelen:1000
          RX bytes:40810690 (38.9 MiB)  TX bytes:9669809 (9.2 MiB)
eth0.105  Link encap:Ethernet  HWaddr 00:1e:8c:64:2c:4a
          inet addr:192.168.105.1  Bcast:192.168.105.255  Mask:255.255.255.0
...
          TX packets:6918 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:296793 (289.8 KiB)  TX bytes:296793 (289.8 KiB)
tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:172.16.1.5  P-t-P:172.16.1.6  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:15 errors:0 dropped:0 overruns:0 frame:0
          TX packets:84 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:836 (836.0 B)  TX bytes:9312 (9.0 KiB)
/dev/pts/7
20:22:10
#vim /etc/network/interfaces
--- /tmp/l3-saved-6098.6848.11927	2009-06-03 20:22:48.000000000 +0300
+++ /etc/network/interfaces	2009-06-03 20:24:25.000000000 +0300
@@ -21,7 +21,7 @@
 
 up ifconfig eth0.205 192.168.205.2 || true
 #network 255.255.255.0
-up ip route add default gw 192.168.205.1 table 1 || true
+up route add default gw 192.168.205.1 table 1 || true
 #vlan_raw_device eth0
 
 
/dev/pts/3
20:22:21
#ip route
172.16.1.6 dev tun0  proto kernel  scope link  src 172.16.1.5
192.168.215.0/24 dev eth0.215  proto kernel  scope link  src 192.168.215.2
192.168.15.0/24 dev eth0  proto kernel  scope link  src 192.168.15.9
192.168.205.0/24 dev eth0.205  proto kernel  scope link  src 192.168.205.2
192.168.105.0/24 dev eth0.105  proto kernel  scope link  src 192.168.105.1
192.168.106.0/24 via 172.16.1.6 dev tun0
default via 192.168.15.254 dev eth0
/dev/pts/0
20:22:23
#ssh 192.168.202.2
ssh: connect to host 192.168.202.2 port 22: Connection refused
/dev/pts/3
20:23:38
#/etc/init.d/networking restart
Reconfiguring network interfaces...Usage: inet_route [-vF] del {-host|-net} Target[/prefix] [gw Gw] [metric M] [[dev] If]
       inet_route [-vF] add {-host|-net} Target[/prefix] [gw Gw] [metric M]
                              [netmask N] [mss Mss] [window W] [irtt I]
                              [mod] [dyn] [reinstate] [[dev] If]
       inet_route [-vF] add {-host|-net} Target[/prefix] [metric M] reject
       inet_route [-FC] flush      NOT supported
if-up.d/mountnfs[eth0]: waiting for interface eth0.105 before doing NFS mounts (warning).
if-up.d/mountnfs[eth0]: waiting for interface eth0.205 before doing NFS mounts (warning).
if-up.d/mountnfs[eth0]: waiting for interface eth0.215 before doing NFS mounts (warning).
Ignoring unknown interface eth0.105=eth0.105.
Ignoring unknown interface eth0.205=eth0.205.
Ignoring unknown interface eth0.215=eth0.215.
done.
20:25:44
#/etc/init.d/networking restart
Reconfiguring network interfaces...if-up.d/mountnfs[eth0]: waiting for interface eth0.105 before doing NFS mounts (warning).
if-up.d/mountnfs[eth0]: waiting for interface eth0.205 before doing NFS mounts (warning).
if-up.d/mountnfs[eth0]: waiting for interface eth0.215 before doing NFS mounts (warning).
Ignoring unknown interface eth0.105=eth0.105.
Ignoring unknown interface eth0.205=eth0.205.
Ignoring unknown interface eth0.215=eth0.215.
done.
/dev/pts/7
20:26:43
#vim /etc/network/interfaces
/dev/pts/0
20:26:51
#ssh 192.168.202.2 30222
ssh: connect to host 192.168.202.2 port 22: Connection refused
20:27:01
#ssh 192.168.202.2 30022
ssh: connect to host 192.168.202.2 port 22: Connection refused
20:27:04
#ssh 192.168.202.2 322
ssh: connect to host 192.168.202.2 port 22: Connection refused
20:27:07
#ping 10.0.35.100
PING 10.0.35.100 (10.0.35.100) 56(84) bytes of data.
64 bytes from 10.0.35.100: icmp_seq=1 ttl=62 time=0.439 ms
64 bytes from 10.0.35.100: icmp_seq=2 ttl=62 time=0.246 ms
64 bytes from 10.0.35.100: icmp_seq=3 ttl=62 time=0.262 ms
^C
--- 10.0.35.100 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1998ms
rtt min/avg/max/mdev = 0.246/0.315/0.439/0.089 ms
/dev/pts/3
20:27:18
#iptables -t nat -A POSTROUTING -o eth0.215 -j MASQUERADE

20:27:24
#iptables -t nat -L
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination
Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination
MASQUERADE  all  --  anywhere             anywhere
MASQUERADE  all  --  anywhere             anywhere
Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
20:27:26
#iptables -t nat -L
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination
Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination
MASQUERADE  all  --  anywhere             anywhere
MASQUERADE  all  --  anywhere             anywhere
Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
/dev/pts/0
20:27:49
#ssh 192.168.205.2
The authenticity of host '192.168.205.2 (192.168.205.2)' can't be established.
RSA key fingerprint is 34:6c:c2:da:38:7c:d7:17:e9:cd:17:8d:e7:cf:f1:a6.
+--[ RSA 2048]----+
|                 |
|     . .     . ..|
|      o =   o ..o|
|   . + + o . + o.|
|    = o S . o o.o|
|     o .   .   o+|
|                =|
...
Warning: Permanently added '192.168.205.2' (RSA) to the list of known hosts.
root@192.168.205.2's password:
Linux linux9 2.6.29-2-686 #1 SMP Sun May 17 17:56:29 UTC 2009 i686
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Wed Jun  3 20:19:55 2009 from 192.168.206.2
l3-agent is already running: pid=17118; pidfile=/root/.lilalo/l3-agent.pid
20:30:07
#ifconfig
eth0      Link encap:Ethernet  HWaddr 00:1e:8c:64:2c:4a
          inet addr:192.168.15.9  Bcast:192.168.15.255  Mask:255.255.255.0
          inet6 addr: fe80::21e:8cff:fe64:2c4a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:77826 errors:0 dropped:0 overruns:0 frame:0
          TX packets:66341 errors:0 dropped:0 overruns:0 carrier:2
          collisions:0 txqueuelen:1000
          RX bytes:41383341 (39.4 MiB)  TX bytes:10266654 (9.7 MiB)
eth0.105  Link encap:Ethernet  HWaddr 00:1e:8c:64:2c:4a
          inet addr:192.168.105.1  Bcast:192.168.105.255  Mask:255.255.255.0
...
          TX packets:7001 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:307987 (300.7 KiB)  TX bytes:307987 (300.7 KiB)
tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:172.16.1.5  P-t-P:172.16.1.6  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:361 errors:0 dropped:0 overruns:0 frame:0
          TX packets:576 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:41656 (40.6 KiB)  TX bytes:263916 (257.7 KiB)
/dev/pts/16
20:30:07
#ifconfig
eth0      Link encap:Ethernet  HWaddr 00:1e:8c:64:2c:4a
          inet addr:192.168.15.9  Bcast:192.168.15.255  Mask:255.255.255.0
          inet6 addr: fe80::21e:8cff:fe64:2c4a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:77826 errors:0 dropped:0 overruns:0 frame:0
          TX packets:66341 errors:0 dropped:0 overruns:0 carrier:2
          collisions:0 txqueuelen:1000
          RX bytes:41383341 (39.4 MiB)  TX bytes:10266654 (9.7 MiB)
eth0.105  Link encap:Ethernet  HWaddr 00:1e:8c:64:2c:4a
          inet addr:192.168.105.1  Bcast:192.168.105.255  Mask:255.255.255.0
...
          TX packets:7001 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:307987 (300.7 KiB)  TX bytes:307987 (300.7 KiB)
tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:172.16.1.5  P-t-P:172.16.1.6  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:361 errors:0 dropped:0 overruns:0 frame:0
          TX packets:576 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:41656 (40.6 KiB)  TX bytes:263916 (257.7 KiB)
/dev/pts/0
20:30:11
#ping 192.168.215.1
PING 192.168.215.1 (192.168.215.1) 56(84) bytes of data.
64 bytes from 192.168.215.1: icmp_seq=1 ttl=64 time=2.57 ms
64 bytes from 192.168.215.1: icmp_seq=2 ttl=64 time=0.903 ms
^C
--- 192.168.215.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 0.903/1.739/2.575/0.836 ms
/dev/pts/16
20:30:11
#ping 192.168.215.1
PING 192.168.215.1 (192.168.215.1) 56(84) bytes of data.
64 bytes from 192.168.215.1: icmp_seq=1 ttl=64 time=2.57 ms
64 bytes from 192.168.215.1: icmp_seq=2 ttl=64 time=0.903 ms
^C
--- 192.168.215.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 0.903/1.739/2.575/0.836 ms
/dev/pts/0
20:30:26
#ip route show
.bash_history  data/          date.log       file0          harddisk.img   .lesshst       .profile       q!             .screenrc      .ssh/          .viminfo
.bash_profile  date05.log     DFJ/           file1          .john/         .lilalo/       psword         screen.dot     .sendxmpp      userad         .vimrc
.bashrc        date2.log      FDGJDGF/       FJHDGFJ/       .l3rc          mailto         q              screen.png     .sendxmpprc    .vim/          .Xauthority
/dev/pts/16
20:30:26
#ip route show
.bash_history  data/          date.log       file0          harddisk.img   .lesshst       .profile       q!             .screenrc      .ssh/          .viminfo
.bash_profile  date05.log     DFJ/           file1          .john/         .lilalo/       psword         screen.dot     .sendxmpp      userad         .vimrc
.bashrc        date2.log      FDGJDGF/       FJHDGFJ/       .l3rc          mailto         q              screen.png     .sendxmpprc    .vim/          .Xauthority
/dev/pts/0
20:30:26
#ip route show table 1

/dev/pts/16
20:30:26
#ip route show table 1

/dev/pts/0
20:31:11
#ip route show table 2

/dev/pts/16
20:31:11
#ip route show table 2

/dev/pts/0
20:31:12
#ip route show table 3

/dev/pts/16
20:31:12
#ip route show table 3

/dev/pts/0
20:31:13
#ip route show
172.16.1.6 dev tun0  proto kernel  scope link  src 172.16.1.5
192.168.215.0/24 dev eth0.215  proto kernel  scope link  src 192.168.215.2
192.168.15.0/24 dev eth0  proto kernel  scope link  src 192.168.15.9
192.168.205.0/24 dev eth0.205  proto kernel  scope link  src 192.168.205.2
192.168.105.0/24 dev eth0.105  proto kernel  scope link  src 192.168.105.1
192.168.106.0/24 via 172.16.1.6 dev tun0
default via 192.168.205.1 dev eth0.205
default via 192.168.15.254 dev eth0
/dev/pts/16
20:31:13
#ip route show
172.16.1.6 dev tun0  proto kernel  scope link  src 172.16.1.5
192.168.215.0/24 dev eth0.215  proto kernel  scope link  src 192.168.215.2
192.168.15.0/24 dev eth0  proto kernel  scope link  src 192.168.15.9
192.168.205.0/24 dev eth0.205  proto kernel  scope link  src 192.168.205.2
192.168.105.0/24 dev eth0.105  proto kernel  scope link  src 192.168.105.1
192.168.106.0/24 via 172.16.1.6 dev tun0
default via 192.168.205.1 dev eth0.205
default via 192.168.15.254 dev eth0
/dev/pts/0
20:31:16
#ip route add default via 192.168.205.1 dev eth0.205 table 2

/dev/pts/16
20:31:16
#ip route add default via 192.168.205.1 dev eth0.205 table 2

/dev/pts/0
20:33:28
#ip route add default via 192.168.215.1 dev eth0.215 table 3

/dev/pts/16
20:33:28
#ip route add default via 192.168.215.1 dev eth0.215 table 3

/dev/pts/0
20:33:36
#ping -I 192.168.205.2 10.0.35.100
PING 10.0.35.100 (10.0.35.100) from 192.168.205.2 : 56(84) bytes of data.
64 bytes from 10.0.35.100: icmp_seq=1 ttl=62 time=0.449 ms
^C
--- 10.0.35.100 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.449/0.449/0.449/0.000 ms
/dev/pts/16
20:33:36
#ping -I 192.168.205.2 10.0.35.100
PING 10.0.35.100 (10.0.35.100) from 192.168.205.2 : 56(84) bytes of data.
64 bytes from 10.0.35.100: icmp_seq=1 ttl=62 time=0.449 ms
^C
--- 10.0.35.100 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.449/0.449/0.449/0.000 ms
/dev/pts/0
20:34:22
#ping -I 192.168.215.2 10.0.35.100
PING 10.0.35.100 (10.0.35.100) from 192.168.215.2 : 56(84) bytes of data.
64 bytes from 10.0.35.100: icmp_seq=1 ttl=62 time=0.248 ms
64 bytes from 10.0.35.100: icmp_seq=2 ttl=62 time=0.254 ms
^C
--- 10.0.35.100 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.248/0.251/0.254/0.003 ms
/dev/pts/16
20:34:22
#ping -I 192.168.215.2 10.0.35.100
PING 10.0.35.100 (10.0.35.100) from 192.168.215.2 : 56(84) bytes of data.
64 bytes from 10.0.35.100: icmp_seq=1 ttl=62 time=0.248 ms
64 bytes from 10.0.35.100: icmp_seq=2 ttl=62 time=0.254 ms
^C
--- 10.0.35.100 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.248/0.251/0.254/0.003 ms
/dev/pts/0
20:34:27
#ip rule add from 192.168.205.2 lookup 2

/dev/pts/16
20:34:27
#ip rule add from 192.168.205.2 lookup 2

/dev/pts/0
20:37:37
#ip rule add from 192.168.215.2 lookup 3

/dev/pts/16
20:37:37
#ip rule add from 192.168.215.2 lookup 3

/dev/pts/3
20:41:07
#vi chroute
--- /dev/null	2009-06-03 09:32:25.504617420 +0300
+++ chroute	2009-06-03 20:56:49.000000000 +0300
@@ -0,0 +1,15 @@
+IP1=192.168.205.2
+IP2=192.168.215.2
+GW1=192.168.205.1
+GW2=192.168.215.1
+
+while true
+do
+if ping -I $IP1 -c 1 10.0.35.1
+then
+        ip route change default $GW1
+else
+        ping -I $IP2 -c 1 10.0.35.1 && ip route change default $GW2
+fi
+sleep 1
+done
/dev/pts/7
20:41:40
#netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
172.16.1.6      0.0.0.0         255.255.255.255 UH        0 0          0 tun0
192.168.215.0   0.0.0.0         255.255.255.0   U         0 0          0 eth0.215
192.168.15.0    0.0.0.0         255.255.255.0   U         0 0          0 eth0
192.168.205.0   0.0.0.0         255.255.255.0   U         0 0          0 eth0.205
192.168.105.0   0.0.0.0         255.255.255.0   U         0 0          0 eth0.105
192.168.106.0   172.16.1.6      255.255.255.0   UG        0 0          0 tun0
0.0.0.0         192.168.205.1   0.0.0.0         UG        0 0          0 eth0.205
0.0.0.0         192.168.15.254  0.0.0.0         UG        0 0          0 eth0
20:45:02
#ssh 192.168.215.1
ssh: connect to host 192.168.215.1 port 22: No route to host
20:45:46