Cisco Catalyst 3750v2, 2960 で作る L3 スイッチでの VLAN 間ルーティング

Router on a Stick 構成ではなく、 L3 スイッチで VLAN 間ルーティングを行う場合の設定。
ASW 2 台と L3 スイッチ 1 台で構成する。
IOS のバージョンはすべて 15 系。
VLAN 間の通信の制限とかは ACL でやるのかな。

ASW1

ASW1(config)#vlan 10,20
ASW1(config-vlan)#exit
ASW1(config)#int range
*Mar  1 06:54:34.872: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down
ASW1(config)#int range
*Mar  1 06:54:35.871: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to down
ASW1(config)#int range
*Mar  1 06:54:38.270: %LINK-3-UPDOWN: Interface FastEthernet0/8, changed state to up
ASW1(config)#int range
*Mar  1 06:54:38.354: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down
*Mar  1 06:54:39.276: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/8, changed state to up
ASW1(config)#int range
*Mar  1 06:54:39.352: %LINK-3-UPDOWN: Interface FastEthernet0/2, changed state to down
*Mar  1 06:54:40.753: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down
ASW1(config)#int range
*Mar  1 06:54:40.996: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar  1 06:54:41.751: %LINK-3-UPDOWN: Interface FastEthernet0/3, changed state to down
*Mar  1 06:54:42.003: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
ASW1(config)#int range
*Mar  1 06:54:45.073: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to down
ASW1(config)#int range
*Mar  1 06:54:45.350: %LINK-3-UPDOWN: Interface FastEthernet0/2, changed state to up
ASW1(config)#int range
*Mar  1 06:54:46.071: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to down
*Mar  1 06:54:46.356: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up
ASW1(config)#int range
*Mar  1 06:54:47.069: %LINK-3-UPDOWN: Interface FastEthernet0/4, changed state to down
ASW1(config)#int range
*Mar  1 06:54:51.389: %LINK-3-UPDOWN: Interface FastEthernet0/3, changed state to up
*Mar  1 06:54:52.396: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up
ASW1(config)#int range
*Mar  1 06:55:06.296: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to up
ASW1(config)#int range fa 0/1-3
ASW1(config-if-range)#swi
ASW1(config-if-range)#switchport mod
ASW1(config-if-range)#switchport mode ac
ASW1(config-if-range)#switchport mode access
ASW1(config-if-range)#exit
ASW1(config)#int fa 0/2
ASW1(config-if)#swi
ASW1(config-if)#switchport a
ASW1(config-if)#switchport ac
ASW1(config-if)#switchport access vl
ASW1(config-if)#switchport access vlan 10
ASW1(config-if)#int fa 0/3
ASW1(config-if)#swi
ASW1(config-if)#switchport ac
ASW1(config-if)#switchport access vl
ASW1(config-if)#switchport access vlan 20
ASW1(config-if)#int fa 0/8
ASW1(config-if)#swi
ASW1(config-if)#switchport mo
ASW1(config-if)#switchport mode tru
ASW1(config-if)#switchport mode trunk
ASW1(config-if)#
*Mar  1 07:07:04.730: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/8, changed state to down
ASW1(config-if)#
*Mar  1 07:07:07.750: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/8, changed state to up
ASW1(config-if)#swi
ASW1(config-if)#switchport tru
ASW1(config-if)#switchport trunk na
ASW1(config-if)#switchport trunk native v
ASW1(config-if)#switchport trunk native vlan 99
ASW1(config-if)#swi
ASW1(config-if)#switchport
*Mar  1 07:07:30.508: %SPANTREE-2-RECV_PVID_ERR: Received BPDU with inconsistent peer vlan id 1 on FastEthernet0/8 VLAN99.
*Mar  1 07:07:30.508: %SPANTREE-2-BLOCK_PVID_PEER: Blocking FastEthernet0/8 on VLAN0001. Inconsistent peer vlan.
*Mar  1 07:07:30.508: %SPANTREE-2-BLOCK_PVID_LOCAL: Blocking FastEthernet0/8 on VLAN0099. Inconsistent local vlan.
ASW1(config-if)#switchport none
ASW1(config-if)#switchport nonegotiate
ASW1(config-if)#
*Mar  1 07:08:15.815: %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet0/8 (99), with DSW FastEthernet1/0/1 (1).
ASW1(config-if)#exit
ASW1(config)#int vlan 1
ASW1(config-if)#ip add
ASW1(config-if)#ip address 172.17.1.100
*Mar  1 07:09:15.819: %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet0/8 (99), with DSW FastEthernet1/0/1 (1).
ASW1(config-if)#ip address 172.17.1.100 255.255.255.0
ASW1(config-if)#no shut
ASW1(config-if)#
*Mar  1 07:10:15.822: %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet0/8 (99), with DSW FastEthernet1/0/1 (1).
ASW1(config-if)#exit
ASW1(config)#ip defa
ASW1(config)#ip default-gateway 172.17.1.254 255.255.255.0
                                             ^
% Invalid input detected at '^' marker.

ASW1(config)#ip default-gateway 172.17.1.254
ASW1(config)#exit
*Mar  1 07:11:15.826: %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet0/8 (99), with DSW FastEthernet1/0/1 (1).
ASW1(config)#exit
ASW1#
*Mar  1 07:11:18.620: %SYS-5-CONFIG_I: Configured from console by console
ASW1#
*Mar  1 07:12:15.830: %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet0/8 (99), with DSW FastEthernet1/0/1 (1).
ASW1#
*Mar  1 07:12:20.184: %SPANTREE-2-UNBLOCK_CONSIST_PORT: Unblocking FastEthernet0/8 on VLAN0001. Port consistency restored.
*Mar  1 07:12:20.184: %SPANTREE-2-UNBLOCK_CONSIST_PORT: Unblocking FastEthernet0/8 on VLAN0099. Port consistency restored.
ASW1#
*Mar  1 07:13:04.626: %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet0/8 (99), with DSW FastEthernet1/0/1 (1).
ASW1#
*Mar  1 07:13:05.658: %SPANTREE-2-RECV_PVID_ERR: Received BPDU with inconsistent peer vlan id 1 on FastEthernet0/8 VLAN99.
*Mar  1 07:13:05.658: %SPANTREE-2-BLOCK_PVID_PEER: Blocking FastEthernet0/8 on VLAN0001. Inconsistent peer vlan.
*Mar  1 07:13:05.658: %SPANTREE-2-BLOCK_PVID_LOCAL: Blocking FastEthernet0/8 on VLAN0099. Inconsistent local vlan.
ASW1#
*Mar  1 07:13:13.560: %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet0/8 (99), with DSW FastEthernet1/0/1 (1).
*Mar  1 07:13:14.567: %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet0/8 (99), with DSW FastEthernet1/0/1 (1).
ASW1#
*Mar  1 07:13:15.574: %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet0/8 (99), with DSW FastEthernet1/0/1 (1).
ASW1#
*Mar  1 07:13:16.580: %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet0/8 (99), with DSW FastEthernet1/0/1 (1).
ASW1#
*Mar  1 07:13:17.587: %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet0/8 (99), with DSW FastEthernet1/0/1 (1).
ASW1#
*Mar  1 07:13:18.593: %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet0/8 (99), with DSW FastEthernet1/0/1 (1).
ASW1#
*Mar  1 07:13:19.600: %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet0/8 (99), with DSW FastEthernet1/0/1 (1).
ASW1#
*Mar  1 07:13:20.607: %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet0/8 (99), with DSW FastEthernet1/0/1 (1).
ASW1#
*Mar  1 07:14:08.808: %SPANTREE-2-UNBLOCK_CONSIST_PORT: Unblocking FastEthernet0/8 on VLAN0001. Port consistency restored.
*Mar  1 07:14:08.808: %SPANTREE-2-UNBLOCK_CONSIST_PORT: Unblocking FastEthernet0/8 on VLAN0099. Port consistency restored.

ASW2

ASW2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
ASW2(config)#vlan 10,20
ASW2(config-vlan)#exit
ASW2(config)#
*Mar  1 06:54:50.819: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down
ASW2(config)#
*Mar  1 06:54:51.817: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to down
ASW2(config)#
*Mar  1 06:54:54.703: %LINK-3-UPDOWN: Interface FastEthernet0/8, changed state to up
*Mar  1 06:54:55.710: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/8, changed state to up
ASW2(config)#
*Mar  1 06:54:58.184: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down
ASW2(config)#
*Mar  1 06:54:59.183: %LINK-3-UPDOWN: Interface FastEthernet0/2, changed state to down
ASW2(config)#
*Mar  1 06:55:00.105: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down
ASW2(config)#
*Mar  1 06:55:00.818: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar  1 06:55:01.103: %LINK-3-UPDOWN: Interface FastEthernet0/3, changed state to down
ASW2(config)#
*Mar  1 06:55:01.707: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to down
*Mar  1 06:55:01.825: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
*Mar  1 06:55:02.706: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to down
ASW2(config)#
*Mar  1 06:55:02.739: %LINK-3-UPDOWN: Interface FastEthernet0/2, changed state to up
*Mar  1 06:55:03.704: %LINK-3-UPDOWN: Interface FastEthernet0/4, changed state to down
*Mar  1 06:55:03.746: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up
ASW2(config)#
*Mar  1 06:55:05.180: %LINK-3-UPDOWN: Interface FastEthernet0/3, changed state to up
*Mar  1 06:55:06.187: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up
ASW2(config)#
*Mar  1 06:55:22.729: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to up
ASW2(config)#int range fa 0/1-3
ASW2(config-if-range)#switchport mode access
ASW2(config-if-range)#exit
ASW2(config)#int fa 0/2
ASW2(config-if)#swi
ASW2(config-if)#switchport ac
ASW2(config-if)#switchport access vl
ASW2(config-if)#switchport access vlan 10
ASW2(config-if)#int fa 0/3
ASW2(config-if)#swi
ASW2(config-if)#switchport a
ASW2(config-if)#switchport ac
ASW2(config-if)#switchport access v
ASW2(config-if)#switchport access vlan 2
ASW2(config-if)#switchport access vlan 20
ASW2(config-if)#int fa 0/8
ASW2(config-if)#swi
ASW2(config-if)#switchport mo
ASW2(config-if)#switchport mode tru
ASW2(config-if)#switchport mode trunk
ASW2(config-if)#
*Mar  1 07:07:12.498: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/8, changed state to down
ASW2(config-if)#
*Mar  1 07:07:15.518: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/8, changed state to up
ASW2(config-if)#switchport trunk native vlan 99
ASW2(config-if)#
*Mar  1 07:07:46.598: %SPANTREE-2-RECV_PVID_ERR: Received BPDU with inconsistent peer vlan id 1 on FastEthernet0/8 VLAN99.
*Mar  1 07:07:46.598: %SPANTREE-2-BLOCK_PVID_PEER: Blocking FastEthernet0/8 on VLAN0001. Inconsistent peer vlan.
*Mar  1 07:07:46.598: %SPANTREE-2-BLOCK_PVID_LOCAL: Blocking FastEthernet0/8 on VLAN0099. Inconsistent local vlan.
ASW2(config-if)#switchport nonegotiate
ASW2(config-if)#
*Mar  1 07:08:23.583: %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet0/8 (99), with DSW FastEthernet1/0/2 (1).
ASW2(config-if)#exit
ASW2(config)#
*Mar  1 07:09:23.595: %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet0/8 (99), with DSW FastEthernet1/0/2 (1).
ASW2(config)#int vlan 1
ASW2(config-if)#ip address 172.17.1.101 255.255.255.0
ASW2(config-if)#no shut
ASW2(config-if)#exit
ASW2(config)#
*Mar  1 07:10:23.599: %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet0/8 (99), with DSW FastEthernet1/0/2 (1).
ASW2(config)#ip default-gateway 172.17.1.254
ASW2(config)#exit
ASW2#
*Mar  1 07:11:22.042: %SYS-5-CONFIG_I: Configured from console by console
ASW2#
*Mar  1 07:11:23.602: %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet0/8 (99), with DSW FastEthernet1/0/2 (1).
ASW2#
*Mar  1 07:12:23.598: %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet0/8 (99), with DSW FastEthernet1/0/2 (1).
ASW2#
*Mar  1 07:12:58.738: %SPANTREE-2-UNBLOCK_CONSIST_PORT: Unblocking FastEthernet0/8 on VLAN0001. Port consistency restored.
*Mar  1 07:12:58.738: %SPANTREE-2-UNBLOCK_CONSIST_PORT: Unblocking FastEthernet0/8 on VLAN0099. Port consistency restored.
ASW2#
*Mar  1 07:13:04.719: %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet0/8 (99), with DSW FastEthernet1/0/2 (1).
ASW2#
*Mar  1 07:13:05.725: %SPANTREE-2-RECV_PVID_ERR: Received BPDU with inconsistent peer vlan id 1 on FastEthernet0/8 VLAN99.
*Mar  1 07:13:05.725: %SPANTREE-2-BLOCK_PVID_PEER: Blocking FastEthernet0/8 on VLAN0001. Inconsistent peer vlan.
*Mar  1 07:13:05.725: %SPANTREE-2-BLOCK_PVID_LOCAL: Blocking FastEthernet0/8 on VLAN0099. Inconsistent local vlan.
ASW2#
*Mar  1 07:13:13.636: %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet0/8 (99), with DSW FastEthernet1/0/2 (1).
*Mar  1 07:13:14.642: %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet0/8 (99), with DSW FastEthernet1/0/2 (1).
ASW2#
*Mar  1 07:13:15.649: %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet0/8 (99), with DSW FastEthernet1/0/2 (1).
ASW2#
*Mar  1 07:13:16.656: %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet0/8 (99), with DSW FastEthernet1/0/2 (1).
ASW2#
*Mar  1 07:13:17.662: %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet0/8 (99), with DSW FastEthernet1/0/2 (1).
*Mar  1 07:13:18.669: %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet0/8 (99), with DSW FastEthernet1/0/2 (1).
ASW2#
*Mar  1 07:13:19.676: %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet0/8 (99), with DSW FastEthernet1/0/2 (1).
ASW2#
*Mar  1 07:13:20.682: %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet0/8 (99), with DSW FastEthernet1/0/2 (1).
ASW2#
*Mar  1 07:14:08.875: %SPANTREE-2-UNBLOCK_CONSIST_PORT: Unblocking FastEthernet0/8 on VLAN0001. Port consistency restored.
*Mar  1 07:14:08.875: %SPANTREE-2-UNBLOCK_CONSIST_PORT: Unblocking FastEthernet0/8 on VLAN0099. Port consistency restored.
ASW2#
*Mar  1 07:19:48.739: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down
*Mar  1 07:19:49.746: %LINK-3-UPDOWN: Interface FastEthernet0/3, changed state to down
ASW2#
*Mar  1 07:19:52.019: %LINK-3-UPDOWN: Interface FastEthernet0/3, changed state to up
*Mar  1 07:19:53.026: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up

DSW

DSW(config)#vlan 10,20,99
DSW(config-vlan)#exit
DSW(config)#int
*Mar  1 07:11:31.966: %SPANTREE-7-RECV_1Q_NON_TRUNK: Received 802.1Q BPDU on non trunk FastEthernet1/0/1 VLAN1.
*Mar  1 07:11:31.966: %SPANTREE-7-BLOCK_PORT_TYPE: Blocking FastEthernet1/0/1 on VLAN0001. Inconsistent port type.
DSW(config)#int range fa 0/1-2
                           ^
% Invalid input detected at '^' marker.

DSW(config)#int range fa 10/1-2
*Mar  1 07:11:48.114: %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet1/0/2 (1), with ASW2 FastEthernet0/8 (99).
DSW(config)#int range fa 1/0/1-2
DSW(config-if-range)#swi
DSW(config-if-range)#switchport tr
DSW(config-if-range)#switchport trunk enca
DSW(config-if-range)#switchport trunk encapsulation do
DSW(config-if-range)#switchport trunk encapsulation dot1q
DSW(config-if-range)#
*Mar  1 07:12:09.840: %SPANTREE-7-RECV_1Q_NON_TRUNK: Received 802.1Q BPDU on non trunk FastEthernet1/0/2 VLAN1.
*Mar  1 07:12:09.840: %SPANTREE-7-BLOCK_PORT_TYPE: Blocking FastEthernet1/0/2 on VLAN0001. Inconsistent port type.
DSW(config-if-range)#swi
DSW(config-if-range)#switchport mo
DSW(config-if-range)#switchport mode tr
DSW(config-if-range)#switchport mode trunk
DSW(config-if-range)#
*Mar  1 07:12:26.190: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0/1, changed state to down
*Mar  1 07:12:26.198: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0/2, changed state to down
DSW(config-if-range)#
*Mar  1 07:12:29.218: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0/1, changed state to up
*Mar  1 07:12:29.243: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0/2, changed state to up
DSW(config-if-range)#
*Mar  1 07:12:29.898: %SPANTREE-2-RECV_PVID_ERR: Received BPDU with inconsistent peer vlan id 99 on FastEthernet1/0/2 VLAN1.
*Mar  1 07:12:29.898: %SPANTREE-2-BLOCK_PVID_PEER: Blocking FastEthernet1/0/2 on VLAN0099. Inconsistent peer vlan.
*Mar  1 07:12:29.898: %SPANTREE-2-BLOCK_PVID_LOCAL: Blocking FastEthernet1/0/2 on VLAN0001. Inconsistent local vlan.
*Mar  1 07:12:30.107: %SPANTREE-2-RECV_PVID_ERR: Received BPDU with inconsistent peer vlan id 99 on FastEthernet1/0/1 VLAN1.
*Mar  1 07:12:30.107: %
DSW(config-if-range)#SPANTREE-2-BLOCK_PVID_PEER: Blocking FastEthernet1/0/1 on VLAN0099. Inconsistent peer vlan.
*Mar  1 07:12:30.107: %SPANTREE-2-BLOCK_PVID_LOCAL: Blocking FastEthernet1/0/1 on VLAN0001. Inconsistent local vlan.
DSW(config-if-range)#
*Mar  1 07:12:40.417: %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet1/0/1 (1), with ASW1 FastEthernet0/8 (99).
DSW(config-if-range)#s
*Mar  1 07:12:48.118: %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet1/0/2 (1), with ASW2 FastEthernet0/8 (99).
DSW(config-if-range)#swi
DSW(config-if-range)#switchport tru
DSW(config-if-range)#switchport trunk na
DSW(config-if-range)#switchport trunk native 99
                                               ^
% Invalid input detected at '^' marker.

DSW(config-if-range)#switchport trunk native ?
  vlan  Set native VLAN when interface is in trunking mode

DSW(config-if-range)#switchport trunk native v
DSW(config-if-range)#switchport trunk native vlan 9
DSW(config-if-range)#switchport trunk native vlan 99
DSW(config-if-range)#swi
DSW(config-if-range)#switchport none
DSW(config-if-range)#switchport nonegotiate
DSW(config-if-range)#exit
DSW(config)#ip ro
DSW(config)#ip rout
*Mar  1 07:13:33.039: %SPANTREE-2-UNBLOCK_CONSIST_PORT: Unblocking FastEthernet1/0/2 on VLAN0099. Port consistency restored.
*Mar  1 07:13:33.039: %SPANTREE-2-UNBLOCK_CONSIST_PORT: Unblocking FastEthernet1/0/2 on VLAN0001. Port consistency restored.
*Mar  1 07:13:33.232: %SPANTREE-2-UNBLOCK_CONSIST_PORT: Unblocking FastEthernet1/0/1 on VLAN0099. Port consistency restored.
*Mar  1 07:13:33.232: %SPANTREE-2-UNBLOCK_CONSIST_PORT: Unblocking FastEthernet1/0/1 on VLAN0001. Port consistency restored.
DSW(config)#ip routi
DSW(config)#ip routing
*Mar  1 07:14:03.061: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to up
DSW(config)#ip routing
DSW(config)#int vlan 1
DSW(config-if)#ip add
DSW(config-if)#ip address 172.17.1.254 255.255.255.0
DSW(config-if)#no shut
DSW(config-if)#int vlan 10
DSW(config-if)#
*Mar  1 07:17:13.458: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up
DSW(config-if)#ip address 172.17.10.254 255.255.255.0
DSW(config-if)#no shut
DSW(config-if)#int vlan 20
DSW(config-if)#
*Mar  1 07:17:28.524: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up
DSW(config-if)#ip address 172.17.20.254 255.255.255.0
DSW(config-if)#no shut
DSW(config-if)#end
DSW#
*Mar  1 07:17:52.985: %SYS-5-CONFIG_I: Configured from console by console

ルーティングテーブルの確認。

DSW#sh ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       + - replicated route, % - next hop override

Gateway of last resort is not set

      172.17.0.0/16 is variably subnetted, 6 subnets, 2 masks
C        172.17.1.0/24 is directly connected, Vlan1
L        172.17.1.254/32 is directly connected, Vlan1
C        172.17.10.0/24 is directly connected, Vlan10
L        172.17.10.254/32 is directly connected, Vlan10
C        172.17.20.0/24 is directly connected, Vlan20
L        172.17.20.254/32 is directly connected, Vlan20

MariaDB 10.1 を CentOS 7.2 にインストールする

/etc/yum.repos.d/MariaDB.repo を作成する。

# MariaDB 10.1 CentOS repository list - created 2016-05-01 03:05 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
sudo yum -y install MariaDB-server MariaDB-client
sudo systemctl enable mariadb
sudo systemctl start mariadb
[root@localhost ~]# systemctl status mariadb
● mariadb.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/mariadb.service.d
           └─migrated-from-my.cnf-settings.conf
   Active: active (running) since 日 2016-05-01 03:14:18 UTC; 11s ago
 Main PID: 3783 (mysqld)
   Status: "Taking your SQL requests now..."
   CGroup: /system.slice/mariadb.service
           └─3783 /usr/sbin/mysqld

 5月 01 03:14:18 localhost.localdomain mysqld[3783]: 2016-05-01  3:14:18 140...
 5月 01 03:14:18 localhost.localdomain mysqld[3783]: 2016-05-01  3:14:18 140...
 5月 01 03:14:18 localhost.localdomain mysqld[3783]: 2016-05-01  3:14:18 140...
 5月 01 03:14:18 localhost.localdomain mysqld[3783]: 2016-05-01  3:14:18 140...
 5月 01 03:14:18 localhost.localdomain mysqld[3783]: 2016-05-01  3:14:18 140...
 5月 01 03:14:18 localhost.localdomain mysqld[3783]: 2016-05-01  3:14:18 140...
 5月 01 03:14:18 localhost.localdomain mysqld[3783]: 2016-05-01  3:14:18 140...
 5月 01 03:14:18 localhost.localdomain mysqld[3783]: 2016-05-01  3:14:18 140...
 5月 01 03:14:18 localhost.localdomain mysqld[3783]: Version: '10.1.13-Maria...
 5月 01 03:14:18 localhost.localdomain systemd[1]: Started MariaDB database ...
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]# mysql -u root
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 10.1.13-MariaDB MariaDB Server

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> exit
Bye

Vagrant の使い方まとめ

Vagrant は仮想マシンを実験できる素晴らしいツールです。
毎度毎度やりたいことを自分で掘り起こすのにつらみを感じてきたのでまとめました。
随時まとめていきます。
最近は Otto も出てきたのでそっちに移行したいですが。

ポートフォワーディングの設定

こんな感じでやると http://localhost:8888/ で 8080 でリッスンする仮想マシンにアクセスできます。

  config.vm.network "forwarded_port", guest: 8080, host: 8888

ブリッジしたい

DHCP

  config.vm.network "public_network"

IP 指定したい

サブネットごえするばあいは VM の中にデフォルトゲートウェイを指定してあげる必要があります。

  config.vm.network "public_network", ip: "192.168.0.17"

NIC を指定する

この場合上だけだと vagrant up するたびにブリッジする NIC を聞かれてうざいので、NIC を指定します。

  config.vm.network "public_network", bridge: "en1: Wi-Fi (AirPort)"

Vagrant box を指定する

僕はよく puppetlabs で提供されている
前までは chef で提供されているものを使ってたんですが、なくなりました。
ATLAS で探してみましょう。

puppetlabs | Atlas by HashiCorp

  config.vm.box = "puppetlabs/centos-7.2-64-nocm"

ATLAS ができる前は野良 Vagrant box を以下から拾ってきたり、セキュリティが気になる場合は Packer で自分で作る必要がありました。

A list of base boxes for Vagrant – Vagrantbox.es

スペックを指定したい(VirtualBox)

デフォルトだと 1 CPU の 2 GB の割当なので、コンピューティングリソースをもう少し増強したい場合は以下の様な指定をする。

  config.vm.provider "virtualbox" do |vb|
    vb.customize ["modifyvm", :id, "--memory", "2048", "--cpus", "2", "--ioapic", "on"]
  end

複数の VM を立ち上げる

何も 1 台構成だけが脳じゃありません。
こんな 3 台構成もできる。

  config.vm.define "web" do |instance|
    instance.vm.box = "puppetlabs/centos-7.2-64-nocm"
    instance.vm.network :private_network, ip: "192.168.33.10"
  end

  config.vm.define "ap" do |instance|
    instance.vm.box = "puppetlabs/centos-7.2-64-nocm"
    instance.vm.network :private_network, ip: "192.168.33.11"
  end

  config.vm.define "db" do |instance|
    instance.vm.box = "puppetlabs/centos-7.2-64-nocm"
    instance.vm.network :private_network, ip: "192.168.33.12"
  end

Windows ユーザーが喜ぶ vagrant ssh の代わりに Tera Term を手軽に使える vagrant-teraterm プラグイン

私も 1 行だけコミットした vagrant-teraterm プラグインというのがあります。
vagrant ssh でもできるが、コマンドプロンプト内で Linux に入るという行為自体がキモい。
これ知る前は毎回 SSH のフォワーディングポート調べて Tera Term 手動で立ち上げて SSH してたんですが、
これで毎回フィンガープリントを確認される不自由から開放されます。
でも、正直 Mac のほうが使いやすいですよ。

vagrant plugin install vagrant-teraterm
vagrant up
vagrant teraterm

シェルプロビジョニングをする

Ansible や Chef を使うほどではないが、毎回立ち上げるたびにコマンドコチコチ入力するのも面倒だというときに一番強力なのがシェルプロビジョニングです。

  config.vm.provision "shell", inline: <<-SHELL
    sudo yum -y install epel-release
    sudo yum -y install --eneblerepo=epel nginx
  SHELL

ある程度出来上がった Vagrant の実行イメージを出力する

これはけっこう強力で、例えばLAN内のローカルミラーを参照するように設定したり、
例えば毎回 vagrant up するたびに Nginx や MySQL をインストールするのは正直だるいって時には vagrant package サブコマンドを使う。
Packer でがんばってやらなくてもいいのでお手軽でおススメ。

ある程度まとまった開発環境ができあがったらそれを他の開発者に配布するという使い方もできる。

vagrant package
rename package.box centos-7.2-x86_64-mysql-5.6.box
vagrant box add centos-7.2-x86_64-mysql-5.6 centos-7.2-x86_64-mysql-5.6.box

add し終わったら Vagrantfile の box 名指定するところにそれを指定して vagrant up すれば特定の役割を持った仮想マシンがいろんなミドルウェアを入れるオーバーヘッドがなくなるので楽ちんなのだ。

プライベートな Vagrant box Registry がほしいなあ。。。

参考リンク

  1. Documentation - Vagrant by HashiCorp
  2. 「hbstudy#60 SerfとConsulでシステム運用を楽しくしよう!」に行ってきました&Serf試してみました - 戦場のプログラマー
  3. RedHat 系 Linux のホスト名を設定する - 戦場のプログラマー
  4. vagrant teraterm が便利すぎてしょうがない件 - 戦場のプログラマー
  5. vagrant-digitalocean provider の簡単な使い方 - 戦場のプログラマー
  6. vagrant-digitalocean で vagrant up すると NoMethodError となる件 - 戦場のプログラマー
  7. Macでvagrant-omnibusプラグインのインストール中にnokogiriのインストールでコケるというお話 - 戦場のプログラマー

テクノロジー系のリリース&イベントカレンダーを作ってみた

Ubuntu, Fedora のリリース日とか、デジタルガジェットの発売日とかを載せてく予定です。
基本ものぐさなのでキャッチアップできていかない気がするので、目的を書いて編集権限リクエストしてくれれば編集権限出しますのでウェルカム。
そんなカレンダーもうあるよって人は教えて下さい。

ちなみに私の趣味の予定も入っています。

Technology Release & Event Calendar