Вы находитесь на странице: 1из 64

IPv6 LAB MANUAL

1
I. General lab information ................................................................................................................... 3

1. Lab diagram:................................................................................................................................ 4

2. Lab Rule ...................................................................................................................................... 4

3. Addresses for Use in Exercise ...................................................................................................... 5

II. Practical scenarios ........................................................................................................................... 8

1. Exercise 1: Configure IPv6 address .............................................................................................. 8

1.1. IPv6 stateless auto-configuration (SLAAC) .......................................................................... 8

1.2. Configure DHCPv6 on windows server 2012 ...................................................................... 10

1.3. Configure IPv6 static address: ............................................................................................ 19

2. Exercise 2: IPv4/IPv6 Dual stack + multihoming........................................................................ 27

3. Exercise 3: Enable IPv6 on DNS System with BIND .................................................................. 38

4. Exercise 4: Enable IPv6 in Apache ............................................................................................. 52

III. Appendix ................................................................................................................................... 54

1. How to Use the vi Editor ............................................................................................................ 54

2. Tài liệu tham khảo ..................................................................................................................... 63

2
I. General lab information
The practical scenarios in this manual are meant to guide the learner to configure
and IPv4 network and then transition the network to IPv6. The IP address indicated
in the diagram is that which shall be used by course participants to access each of
the routers, servers in the lab, using either telnet or ssh. You can use Putty for ssh
or telnet client. Each participant need prepare a laptop connect to the lab by
wireless.

During our training workshops, an individual or group is assigned to each router or


each server and they must work as a team with the other individuals/teams on the
other routers to complete the exercise.

3
1. Lab diagram:
Gi2
Gi1
Router 4 .2 .1 Router 3
AS 3
AS 4 eBGP
Loopback 0: 3.3.3.3/24
Loopback 0:
.1 IPv6:2001:DC34::/64 .2 2001:2003::1/48
4.4.4.4/24 Router
Gi1 1GGi Router 1Gi2
IPv4:192.168.34.0/24
2001:2001::3/48

IPv4:192.168.23.0/24
IPv6:2001:DC23::/64
IPv4:192.168.41.0/24
IPv6:2001:DC41::/64
telnet ipv6/ipv6
Enable password: ipv6

eBGP
eBGP
Gi2 Gi1
Gi1
.2 .1
IPv6:2001:DC12::/64 .2 .1
IPv4:192.168.12.0/24 Gi2
Router 1 Router 2
AS 1 eBGP
AS 2
Loopback 0: 1.1.1.1/24 Loopback 0: 2.2.2.2/24
Router 1GGi Router 1
Gi1
2001:2001::1/48 2001:2002::1/48

Lab
IPv6:2001:DC1::/64
IPv4:192.168.1.0/24
Router management ip
SWITCH
Gi3 Router 1: 192.168.1.1
Gi3 Router 2:192.168.1.2
Gi3 Router 3: 192.168.1.3
Gi3 Router 4: 192.168.1.4 .....
Dual Stack IPv4/IPv6
PC1 => PC10

Figure 1: Lab diagram

2. Lab Rule

- Don't change the management interface configuration.


- Don't remove IPv4 static routes.
- Don't change login/password information.
- Don't change filtering policy on the routers.
- Don't change the console line configuration.
- Don't change interfaces description.

4
- These are not just rules designed to make your life miserable, but failure to
comply might mean you lose access to the labs, thus ending your practice session

3. Addresses for Use in Exercise

ST Network ASN IPv4 Prefix IPv6 Prefix


1 Lab + Wifi 192.168.1.0/24 2001:dc1::/48
2 Router 1 1 1.1.1.1/32 2001:2001::1/128
3 Router 2 2 2.2.2.2/32 2001:2002::2/128
4 Router 3 3 3.3.3.3/32 2001:2003::3/128
5 Router 4 4 4.4.4.4/32 2001:2004::4/128

ST Devices Địa chi IP Description


1 Router 1 o Interface 1:
ASN 1 - IPv6: 2001:dc12::1/64
- IPv4: 192.168.12.1/24
o Interface 2:
- IPv6: 2001:dc41::2/64
- IPv4: 192.168.41.2/24
o Interface 3: Management
- IPv6: 2001:dc1::1/64 Interface
- IPv4: 192.168.1.1/24
o Interface lo: Loop back
- IPv6: 2001:2001::1/128 address
- IPv4: 1.1.1.1/32

5
2 Router 2 o Interface 1:
ASN 2 - IPv6: 2001:dc23::1/64
- IPv4: 192.168.23.1/24
o Interface 2:
- IPv6: 2001:dc12::2/64
- IPv4: 192.168.12.2/24
o Interface 3: Management
- IPv6: 2001:dc1::2/64 Interface
- IPv4: 192.168.1.2/24
o Interface lo: Loop back
- IPv6: 2001:2002::1/128 address
- IPv4: 2.2.2.2/32
3 Router 3 o Interface 1:
ASN 3 - IPv6: 2001:dc34::1/64
- IPv4: 192.168.34.1/24
o Interface 2:
- IPv6: 2001:dc23::2/64
- IPv4: 192.168.23.2/24
o Interface 3: Management
- IPv6: 2001:dc1::3/64 Interface
- IPv4: 192.168.1.3/24
o Interface lo: Loop back
- IPv6: 2001:2003::1/128 address
- IPv4: 3.3.3.3/32

6
4 Router 4 o Interface 1:
ASN 4 - IPv6: 2001:dc41::1/64
- IPv4: 192.168.41.1/24
o Interface 2:
- IPv6: 2001:dc34::2/64
- IPv4: 192.168.34.2/24
o Interface 3: Management
- IPv6: 2001:dc1::4/64 Interface
- IPv4: 192.168.1.4/24
o Interface lo: Loop back
- IPv6: 2001:2004::1/128 address
- IPv4: 4.4.4.4/32
5 Wireless 1 SSID: IPv6-LAB-1
Password:ipv6@2018

7
II. Practical scenarios
1. Exercise 1: Configure IPv6 address

1.1. IPv6 stateless auto-configuration (SLAAC)


Enable IPv6 in Windows

 Enable IPv6 from GUI.

- On the Start screen, type Control Panel. Press Enter.


- Select Network and Internet.
- On the left side of the Network and Sharing Center, select Change Adapter
Settings.
- Right-click your network connection, choose Properties

Select  in Internet Protocol Version 6 (TCP/IPv6), click OK

Configure SLAAC in Router

Enter privileged EXEC mode R1>enable


8
Enter global configuration mode R1#configure terminal
Enable IPv6 routing R1(config)#ipv6 unicast-routing
Enter interface configuration mode R1(config)#interface gi3
Configure an IPv6 address R1(config-if)#ipv6 address 2001:DC1::1/64
Enable IPv6 on the interface R1(config-if)#ipv6 enable
Enable the interface R1(config-if)#no shutdown

Verify command in router

R1#debug ipv6 icmp or debug ipv6 nd

Verify command in windows

9
1.2. Configure DHCPv6 on windows server 2012

These are the steps necessary to add the DHCP server role to a Windows Server 2012
computer:

Step 1: In Server Manager, click Add roles and features

Step 2: In the Add Roles and Features Wizard, click Next.

Step 3: On the Select installation type page, click Next.


10
Step 4: On Select destination server page, click Next.

Step 5: On the Select server roles page, select the DHCP Server check box.

11
Step 6: In the Add Roles and Features Wizard, click Add Features, and then click Next.

12
Step 7: On the Select features page, click Next.

Step 8: On the DHCP Server page, click Next.

Step 9: On the Confirm installation selections page, click Install.

13
Step 10: On the Installation progress page, wait until the Installation succeeds.

Once the installation completes, you can proceed to authorize the DHCP server or start
configuring the DHCP scopes.

Note: In an active directory infrastructure, to prevent an incorrectly configured DHCP


server or a rogue DHCP server from distributing IP addresses, DHCP servers are not
allowed to start servicing clients before they are authorized to operate in the network.
DHCP authorization is the process of registering the DHCP Server in the active directory
database to service DHCP clients. An enterprise administrator account is necessary to
14
authorize Windows Server 2012 DHCP servers; once it is authorized, the DHCP server
can support multiple domains in the same active directory forest.

A standalone (no domain member) Windows Server 2012 DHCP server can detect an
authorized DHCP server in a domain. When that happens, the standalone DHCP server
does not lease IP addresses and shuts down automatically.

Step 11: On the DHCP Server console, right click IPv6 and select New Scope.

Step 12: On the Welcome to the New Scope Wizard, click Next

15
Step 13: On the Scope Name, enter Name and Description information.

16
Step 14: On the Scope Prefix, enter the corresponding prefix for your IPv6 network. If
you have multiple DHCPv6 servers, the preference value can be modified to indicate
your priority among the servers. The lower this value, the higher the priority.

Step 15:On the Add Exclusions, enter any IPv6 address that belongs to that scope but
has been manually assigned to other devices in the network. This includes the IPv6
address that is manually configured on the DHCPv6 server itself. Additional exclusion
can be added after the initial DHCPv6 scope has been configured.

17
Step 16: On the Scope Lease, configure two settings:

Preferred Life Time is the length of time that a valid IPv6 address is preferred. When this time
expires, the address becomes deprecated but it is still valid.

Valid Life Time is the length of time that an IPv6 is in the valid state. The address becomes
invalid after the valid life time expires. The valid life rime must be equal or greater than the
preferred life time.

18
As on IPv4 scopes, you can configure exclusions, reservations, and DHCP options on
IPv6 scopes. However, DHCPv6 clients do not use their MAC addresses when contacting
a DHCP server. Instead a device unique identifier (DUID) is used by clients to get an IP
address from a DHCPv6 server.

1.3. Configure IPv6 static address:


Configure IPv6 static address in Windows

You can disable SLAAC in windows ( open “cmd” with “run as administrator”)

netsh interface ipv6 set interface "Local Area Connection" routerdiscovery=disabled

Configure IPv6 address from GUI

- Logon to the server with administrator rights


- Click on Start | Network | Network and Sharing Center | Change Adapter Setting
- Right-click on the Local Area Connection of the network adapter I want to set
IPv6 and choose Properties
- Highlight Internet Protocol Version 6 (TCP/IPv6) and click on Properties
- Click on “Use the following IPv6 address” and in the IPv6 Address field, type in
the IP address you want to use
19
- Configure IPv6 address from command line
Open Command prompt. Start>cmd>Enter. Right click at cmd.exe and choose “Run as
Administrator”

Check interface information:

>netsh interface

20
netsh interface>show interface

Add IPv6 address:

netsh interface ipv6 add address "Local Area Connection" 2001:dcx::x

Add IPv6 default route

netsh interface ipv6 add route ::/0 "Local Area Connection" 2001:dcx::1

Add DNS Server

netsh interface ipv6 add dnsserver "Local Area Connection" 2001:dcx::x

Verify the configuration:

netsh interface ipv6 show address “ Local Area Connection”

21
Ipconfig /all

netsh interface ipv6 show route

The interface ID (the last 64 bits of a unicast IPv6 address) can be:

 Based on the IEEE 802 address of an installed network adapter


22
The IEEE 802 address, commonly referred to as a media access control (MAC)
address, is 48 bits and assigned to each network adapter as it is manufactured. The
Extended Unique Identifier (EUI)-64 address is a newer 64-bit MAC address.
IEEE 802 addresses can be converted to EUI-64 addresses. Interface IDs for
unicast IPv6 addresses can be based on the EUI-64 address of a network adapter.

 Randomly-generated

RFC 3041 defines temporary IPv6 addresses, which use a randomly generated
interface ID and a relatively short valid lifetime. Temporary IPv6 addresses are
typically used by client applications when initiating communication, such as a
Web browser, and are not registered in DNS. Public IPv6 addresses are typically
used by server applications for incoming connections, such as a Web server, and
are registered in DNS. Public IPv6 addresses can have randomly generated or
EUI-64-based interface IDs.

We can disable randomly-generated

netsh interface ipv6 set global randomizeidentifiers=disabled

Disable temporary ipv6 address

Netsh interface ipv6 set privacy=enabled


Refenrence:
https://technet.microsoft.com/en-us/magazine/2007.08.cableguy.aspx

Configure IPv6 address in Linux.

Disable SLAAC in Linux

Disable on interface eth0

sudo sysctl -w net.ipv6.conf.eth0.autoconf=0


sudo sysctl -w net.ipv6.conf.eth0.accept_ra=0

Or all interfaces

#sudo sysctl -w net.ipv6.conf.all.autoconf=0


#sudo sysctl -w net.ipv6.conf.all.accept_ra=0
Disable permanently file /etc/sysctl.conf

net.ipv6.conf.all.accept_ra = 0
23
net.ipv6.conf.default.accept_ra = 0
Thêm lệnh vào trong file /etc/sysconfig/network

NETWORKING_IPV6=yes

IPV6_AUTOCONF=no

Enable IPv6 in Linux: open file /etc/sysconfig/network

# vi /etc/sysconfig/network

- Append following line

NETWORKING_IPV6=yes

Configure IPv6 address in Linux

Open file /etc/sysconfig/network-scripts/ifcfg-eth0

# vi /etc/sysconfig/network-scripts/ifcfg-eth0

Append following config directives for IPv6

IPV6INIT=yes
IPV6ADDR=<IPv6-IP-Address>
IPV6_DEFAULTGW=<IPv6-IP-Gateway-Address>

Example

DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
HWADDR=00:30:48:33:bc:33
IPADDR=192.168.1.10
GATEWAY=192.168.1.1
NETMASK=255.255.255.0
IPV6INIT=yes
IPV6ADDR=2001:DC1::10/64
IPV6_DEFAULTGW=2001:DC1::1

24
Save and close the file. Restart networking:

# service network restart

Verify your configuration

$ ifconfig –a

Verify interface state:

# mii-tool- eth0

#ethtool eth0

#cat /sys/class/net/eth0/operstate

#ifconfig eth0

25
Verify IPv6 routing table

$netstat –rn –A inet6

Verify your configuration

$ ping6 2001:DC1::1

26
2. Exercise 2: IPv4/IPv6 Dual stack + multihoming

 Router 1

Description Command line

Enable ipv6 routing R1# configure terminal


1
R1(config)#ipv6 unicast-routing

R1(config)#interface gigabitethernet 1

R1(config-if)#ipv6 enable

2 Configure Interface 1 R1(config-if)#ipv6 address 2001:DC12::1/64

R1(config-if)#ip address 192.168.12.1 255.255.255.0

R1(config-if)#ipv6 nd ra suppress all

R1(config)#interface gigabitethernet 2

R1(config-if)#ipv6 enable

3 Configure Interface 2 R1(config-if)#ipv6 address 2001:DC41::2/64

R1(config-if)#ip address 192.168.41.2 255.255.255.0

R1(config-if)#ipv6 nd ra suppress all

R1(config)#interface gigabitethernet 3

R1(config-if)#ipv6 enable

4 Configure Interface 3 R1(config-if)#ipv6 address 2001:DC1::1/64

R1(config-if)#ip address 192.168.1.1 255.255.255.0

R1(config-if)#ipv6 nd ra suppress all

Configure Interface
R1(config)#interface loopback 0
loopback

27
R1(config-if)#ipv6 enable

R1(config-if)#ipv6 address 2001:2001::1/128

R1(config-if)#ip address 1.1.1.1 255.255.255.255

R1(config-if)#no shut

R1(config)#router bgp 1

R1(config-router)# no bgp default ipv4-unicast


5 Enable BGP
R1(config-router)# bgp log-neighbor-changes

R1(config-router)# bgp router-id 1.1.1.1

R1(config)#router bgp 1

R1(config-router)#neighbor 192.168.12.2 remote-as 2

R1(config-router)#neighbor 192.168.41.1 remote-as 4

R1(config-router)#neighbor 2001:DC12::2 remote-as 2

R1(config-router)#neighbor 2001:DC41::1 remote-as 4


6
Configure BGP session R1(config-router)#address-family ipv4

R1(config-router)#neighbor 192.168.12.2 activate

R1(config-router)#neighbor 192.168.41.1 activate

R1(config-router)#address-family ipv6

R1(config-router-af)# neighbor 2001:DC12::2 activate

R1(config-router-af)# neighbor 2001:DC41::1 activate

R1(config-router)#address-family ipv6

R1(config-router-af)#network 2001:2001::/48
7 Annouce IPv6 prefix
R4(config-router)#address-family ipv4

R1(config-router-af)#network 1.1.1.0 mask

28
255.255.255.0

R1(config)#Ipv6 route 2001:2001::/48 null 0


8 Static route null 0
R1(config)#Ip route 1.1.1.0 255.255.255.0 null 0

 Router 2

Description Command line

Enable ipv6 routing R2# configure terminal


1
R2(config)#ipv6 unicast-routing

R2(config)#interface gigabitethernet 1

R2(config-if)#ipv6 enable

2 Configure Interface 1 R2(config-if)#ipv6 address 2001:DC23::1/64

R2(config-if)#ip address 192.168.23.1 255.255.255.0

R2(config-if)#ipv6 nd ra suppress all

R2(config)#interface gigabitethernet 2

R2(config-if)#ipv6 enable

3 Configure Interface 2 R2(config-if)#ipv6 address 2001:DC12::2/64

R2(config-if)#ip address 192.168.12.2 255.255.255.0

R2(config-if)#ipv6 nd ra suppress all

R2(config)#interface gigabitethernet 3

4 Configure Interface 3 R2(config-if)#ipv6 enable

R2(config-if)#ipv6 address 2001:DC1::2/64

29
R2(config-if)#ip address 192.168.1.2 255.255.255.0

R1(config-if)#ipv6 nd ra suppress all

R2(config)#interface loopback 0

R2(config-if)#ipv6 enable
Configure Interface
4 R2(config-if)#ipv6 address 2001:2002::1/128
loopback
R2(config-if)#ip address 2.2.2.2 255.255.255.255

R2(config-if)#no shut

R2(config)#router bgp 2

5 Enable BGP R2(config-router)# no bgp default ipv4-unicast

R2(config-router)# bgp log-neighbor-changes


R1(config-router)# bgp router-id 2.2.2.2
R2(config)#router bgp 2

R2(config-router)#neighbor 2001:DC12::1 remote-as 1

R2(config-router)#neighbor 2001:DC23::2 remote-as 3

R2(config-router)#neighbor 192.168.12.1 remote-as 1

R2(config-router)#neighbor 192.168.23.2 remote-as 3

6 Configure BGP session R2(config-router)#address-family ipv4

R2(config-router-af)# neighbor 192.168.23.2 activate

R2(config-router-af)# neighbor 192.168.12.1 activate

R2(config-router)#address-family ipv6

R2(config-router-af)# neighbor 2001:DC12::1 activate

R2(config-router-af)# neighbor 2001:DC23::2 activate

R2(config-router-af)#network 2001:2002::/48
7 Annouce IPv6 prefix
R2(config-router-af)#network 2.2.2.0 mask

30
255.255.255.0

R2(config)#Ipv6 route 2001:2002::/48 null 0


8 Static route null 0
R2(config)#Ip route 2.2.2.0 255.255.255.0 null 0

 Router 3

Description Command line

Enable ipv6 routing R3# configure terminal


1
R3(config)#ipv6 unicast-routing

R3(config)#interface gigabitethernet 1

R3(config-if)#ipv6 enable

2 Configure Interface 1 R3(config-if)#ipv6 address 2001:DC34::1/64

R3(config-if)#ip address 192.168.34.1 255.255.255.0

R3(config-if)#ipv6 nd ra suppress all

R3(config)#interface gigabitethernet 2

R3(config-if)#ipv6 enable

3 Configure Interface 2 R3(config-if)#ipv6 address 2001:DC23::2/64

R3(config-if)#ip address 192.168.23.2 255.255.255.0

R3(config-if)#ipv6 nd ra suppress all

R3(config)#interface gigabitethernet 3

4 Configure Interface 3 R3(config-if)#ipv6 enable

R3(config-if)#ipv6 address 2001:DC1::3/64

31
R3(config-if)#ip address 192.168.1.3 255.255.255.0

R3(config-if)#ipv6 nd ra suppress all

R3(config)#interface loopback 0

Configure Interface R3(config-if)#ipv6 enable


loopback R3(config-if)#ipv6 address 2001:2003::1/128

R3(config-if)#ip address 3.3.3.3 255.255.255.255

R3(config)#router bgp 3

5 Enable BGP R3(config-router)# no bgp default ipv4-unicast

R3(config-router)# bgp log-neighbor-change


R3(config-router)# bgp router-id 3.3.3.3
R3(config)#router bgp 3

R3(config-router)#neighbor 192.168.23.1 remote-as 2

R3(config-router)#neighbor 192.168.34.2 remote-as 4

R3(config-router)#neighbor 2001:DC23::1 remote-as 2

R3(config-router)#neighbor 2001:DC34::2 remote-as 4

6 Configure BGP session R3(config-router)#address-family ipv4

R3(config-router-af)# neighbor 192.168.23.1 activate

R3(config-router-af)# neighbor 192.168.34.2 activate

R3(config-router)#address-family ipv6

R3(config-router-af)# neighbor 2001:DC23::1 activate

R3(config-router-af)# neighbor 2001:DC34::2 activate

R3(config-router)#address-family ipv6
7 Annouce IP prefixes
R3(config-router-af)#network 2001:2003::/48

32
R3(config-router)#address-family ipv4

R3(config-router-af)#network 3.3.3.0 mask


255.255.255.0

R3(config-router)#Ipv6 route 2001:2003::/48 null 0


8 Static route null 0
R3(config-router)#Ip route 3.3.3.0 255.255.255.0 null 0

 Router 4

Description Command line

Enable ipv6 routing R4# configure terminal


1
R4(config)#ipv6 unicast-routing

R4(config)#interface gigabitethernet 1

R4(config-if)#ipv6 enable

2 Configure Interface 1 R4(config-if)#ipv6 address 2001:DC41::1/64

R4(config-if)#ip address 192.168.41.1 255.255.255.0

R4(config-if)#ipv6 nd ra suppress all

R4(config)#interface gigabitethernet 2

R4(config-if)#ipv6 enable

3 Configure Interface 2 R4(config-if)#ipv6 address 2001:DC34::2/64

R4(config-if)#ip address 192.168.34.2 255.255.255.0

R4(config-if)#ipv6 nd ra suppress all

R4(config)#interface gigabitethernet 3
4 Configure Interface 3
R4(config-if)#ipv6 enable

33
R4(config-if)#ipv6 address 2001:DC1::4/64

R4(config-if)#ip address 192.168.1.4 255.255.255.0

R4(config-if)#ipv6 nd ra suppress all

R4(config)#interface loopback 0

Configure Interface R4(config-if)#ipv6 enable


loopback R4(config-if)#ipv6 address 2001:2004::1/128

R4(config-if)#ip address 4.4.4.4 255.255.255.255

R4(config)#router bgp 4

5 Enable BGP R4(config-router)# no bgp default ipv4-unicast

R4(config-router)# bgp log-neighbor-changes


R4(config-router)# bgp router-id 4.4.4.4
R4(config)#router bgp 4

R4(config-router)# neighbor 192.168.34.1 remote-as 3

R4(config-router)# neighbor 192.168.41.2 remote-as 1

R4(config-router)#neighbor 2001:DC34::1 remote-as 3

R4(config-router)#neighbor 2001:DC41::2 remote-as 1

6 Configure BGP session R4(config-router)#address-family ipv4

R4(config-router-af)# neighbor 192.168.34.1 activate

R4(config-router-af)# neighbor 192.168.41.2 activate

R4(config-router)#address-family ipv6

R4(config-router-af)# neighbor 2001:DC34::1 activate

R4(config-router-af)# neighbor 2001:DC41::2 activate

7 Annouce IPv6 prefix R4(config-router)#address-family ipv6

34
R4(config-router-af)#network 2001:2004::/48

R4(config-router)#address-family ipv4

R4(config-router-af)#network 4.4.4.0 mask


255.255.255.0

R4(config-router)#Ipv6 route 2001:2004::/48 null 0


8 Static route null 0
R4(config-router)#Ip route 4.4.4.0 255.255.255.0 null 0

Verify BGP session

# show bgp ipv6 unicast summary


#show ip bgp summary

Verify BGP routing table and routing table

# show bgp ipv6 unicast


# show ipv6 route
#show ip bgp
#show ip route
Kiểm tra kết nối sử dụng lệnh ping giữa các loopback.

Thiết lập chính sách định tuyến:

AS1: Tất cả định tuyến đến 3.3.3.0/24 và 2001:2003::/48 (R3) đi qua R4

AS2: Tất cả định tuyến đến 4.4.4.0/24 và 2001:2004::/48 (R4) đi qua R3

AS3: Tất cả định tuyến đến 1.1.1.0/24 và 2001:2001::/48 (R1) đi qua R4

AS4: Tất cả định tuyến đến 2.2.2.0/24 và 2001:2002::/48 (R2) đi qua R3

Sử dụng local preference để thực thi chính sách cho các route tương ứng

R1:

35
TT Description
Command

R1(config)#router bgp 1

R1(config)#address-family ipv4

R1(config-router-af)# neighbor 192.168.41.1 route-map


ipv4-as3-incoming in

Route-map ipv4-as3-incoming permit 10

match ip address prefix-list as3-ipv4-prefixes

set local-preference 200

Route-map ipv4-as3-incoming permit 20

match ip address prefix-list remain-incoming

set local-preference 0
Policy BGP prefixes using !
1
route-map
Ip prefix-list as3-ipv4-prefixes permit 3.3.3.0/24

ip prefix-list remain-incoming permit 0.0.0.0/0 le 32

R1(config)#router bgp 1

R1(config-router)# neighbor 2001:dc41.1 remote-as 2

R1(config-router)# neighbor 2001:dc12.2 route-map


ipv6-as3-incoming in

Route-map ipv6-as3-incoming permit 10

Match ip address prefix-list as3-ipv6-prefixes

Set local-perference 200

Route-map ipv6-as3-incoming permit 20

36
Match ip address prefix-list ipv6remain

Set local-perference 0

Ip prefix-list as3-ipv6-prefixes permit 2001:2003::/48


ip prefix-list ipv6-remain permit ::/0 le 128

Tương tự với R2, R3, R4.

Kiểm tra tính khả thi chính sách định tuyến bằng lệnh show ip bgp, show bgp ipv6
unicast.

37
3. Exercise 3: Enable IPv6 on DNS System with BIND
Scenario: In this lab, the whole system has been set up and running on IPv4, using Bind
software running on Centos.

+ Each trainees will manage one zone: hvxx.labipv6.vn, where xx is the student number.

- Configuration file of named: /etc/named.conf

- Directory containing zone information: /var/named

From the client machine, which installed the Secure Shell Client software.
The trainees ssh to the server with the assigned address, using the root account and
password provided.

The trainee's tasks include the following:

Case 1: Check the status of DNS servers base on IPv4.


In this section, you will have to:
Step 1: Check whether the DNS service is running or not.
(Record results)

------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------

Step 2: Edit the xx information of the zone hvxx.labipv6.vn in the named.conf file
according to the number of the students: For example, the student’s number is 01, you
have to changed to hv01.labipv6.vn.
(Record the lines which be editted)

------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------

Step 3: Check if the configuration file named.conf is properly structured.


(Record results)

------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------

38
Step 4: Use the mv command to change the file name /etc/named/db.hvxx.labipv6.vn
into the corresponding file in the order number of the student.
(Record results)

------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------

Step 5: Use the vi command to edit the contents of the file


/etc/named/db.hvxx.labipv6.vn, the contents are hvxx corresponding to the number of
students.
Note: Every time the data file changes, the serial should be increased.

------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------

Step 6: Check the data file for the hvxx.labipv6.vn zone on the system.
(Record results)

------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------

Step 7: Stop, start named process

(ghi lại kết quả)

------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------

Step 8: Query the DNS server (according to the IPv4 address of the server) to see if the
server responds to the domain name query hvxx.labipv6.vn.
(Record results)

------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------

Case 2: Configure the DNS server to listen for queries on the IPv6 interface.

39
Step 1: Configuration allows the DNS server to listen for queries on the IPv6 address
interface by adding the following line to the option of the named.conf file.

listen-on-v6 {any; };

Step 2: Check if the configuration file named.conf is properly structured.


(Record results)

------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------

Step 3: Restart named, make sure the named process is working.


(Record results)

------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------

Step 4: Query the DNS server (at the IPv6 address of the server) to see if the server is
listening and responding to queries via IPv6.

(Record results)

------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------

Case 3: Declare resource records specific to IPv6.


Situational analysis: When a unit deployed web service, with website is:
http://www.hvxx.labipv6.vn, web content is hosted on a server using IPv6 address: 2001:
dcx :: x,

The task of the DNS admin is to declare the record

www.hvxx.labipv6.vn. IN AAAA 2001:dcx::x

In the zone data file /var/named/db.hvxx.labipv6.vn of the zone hvxx.labipv6.vn

40
Step 1: Use the vi command to add a record to the end of /var/named/db.hvxx.labipv6.vn

www.hvxx.labipv6.vn. IN AAAA 2001:dcx::x;

Note 1: Must have “.” after the domain name to indicate that the domain is full
Note 2: each time change the zone file, have to increase the serial.

Step 2: Check the data file for the hvxx.labipv6.vn zone on the system.
(Record results)

------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------

Step 3: Restart named, make sure the named process is working.


(Record results)

------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------

Step 4: Query the DNS server with the domain name www.hvxx.labipv6.vn and record
type AAAA to check the results.

(Record results)

------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------

41
LAB DNS GUIDE

Case 1: Check the status of DNS servers base on IPv4.


In this section, you will have to:
Step 1: Check whether the DNS service is running or not.
(Record results)

[root@localhost ~]# ps -ef | grep named


root 14250 1 0 Apr21 ? 00:00:00 /usr/local/sbin/named -c /etc/named.conf
[root@localhost ~]#

Step 2: Edit the xx information of the zone hvxx.labipv6.vn in the named.conf file
according to the number of the students: For example, the student’s number is 01, you
have to changed to hv01.labipv6.vn.
(Record the lines which be editted)

[root@localhost ~]# more /etc/named.conf


options {
directory "/var/named";
pid-file "/var/run/named/name.pid";
listen-on port 53 { 127.0.0.1; any; };
allow-query { any; };
recursion yes;
};

zone "." IN {
type hint;
file "db.cache";
};
zone "hv01.labipv6.vn." IN {
type master;
file "db.hv01.labipv6.vn";
};
[root@localhost ~]#

42
Step 3: Check if the configuration file named.conf is properly structured.
(Record results)

[root@localhost ~]# /usr/local/sbin/named-checkconf /etc/named.conf


[root@localhost ~]#

Step 4: Use the mv command to change the file name /etc/named/db.hvxx.labipv6.vn


into the corresponding file in the order number of the student.
(Record results)

[root@localhost ~]# cd /var/named/


[root@localhost named]# ls
db.cache db.hvxx.labipv6.vn named.empty named.localhost named.loopback
sử dụng lệnh mv để đổi tên file.
[root@localhost named]# mv db.hvxx.labipv6.vn db.hv01.labipv6.vn
Kiểm tra lại:
[root@localhost ~]# ls /var/named/
db.cache db.hv01.labipv6.vn named.empty named.localhost named.loopback
[root@localhost ~]#

Step 5: Use the vi command to edit the contents of the file


/etc/named/db.hvxx.labipv6.vn, the contents are hvxx corresponding to the number of
students.
Note: Every time the data file changes, the serial should be increased.

[root@localhost ~]# vi /var/named/db.hvxx.labipv6.vn


$TTL 86400;
@ IN SOA dns-dc01.hv01.labipv6.vn. hostmaster.hv01.labipv6.vn. (
2016010502; serial
1800; refresh
900; retry
604800; expiry

43
5400; minimum negative ttl
);
IN NS dns-dc01.hv01.labipv6.vn.
$ORIGIN hv01.labipv6.vn.
dns-dc01 IN A 192.168.1.100
www IN A 192.168.1.100

Step 6: Check the data file for the hvxx.labipv6.vn zone on the system.
(Record results)
[root@localhost ~]# /usr/local/sbin/named-checkzone hv01.labipv6.vn /var/named/db.hv01.labipv6.vn

zone hv01.labipv6.vn/IN: loaded serial 2016010502

OK

[root@localhost ~]#

Step 7: Stop, start named process

(Record results)

[root@localhost ~]# ps -ef | grep named


root 14250 1 0 Apr21 ? 00:00:00 /usr/local/sbin/named -c /etc/named.conf
[root@localhost ~]# kill -9 14250
[root@localhost ~]# /usr/local/sbin/named -c /etc/named.conf
[root@localhost ~]# ps -ef | grep named
root 14425 1 1 00:20 ? 00:00:00 /usr/local/sbin/named -c /etc/named.conf
[root@localhost ~]#

Step 8: Query the DNS server (according to the IPv4 address of the server) to see if the
server responds to the domain name query hvxx.labipv6.vn.
(Record results)

[root@localhost ~]# dig @192.168.1.10 www.hvxx.labipv6.vn +norec

44
; <<>> DiG 9.10.2-P4 <<>> @192.168.1.10 www.hvxx.labipv6.vn +norec
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 35342
;; flags: qr aa ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 2

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.hvxx.labipv6.vn. IN A

;; ANSWER SECTION:
www.hvxx.labipv6.vn. 86400 IN A 192.168.1.100

;; AUTHORITY SECTION:
hvxx.labipv6.vn. 86400 IN NS dns-dcxx.hvxx.labipv6.vn.

;; ADDITIONAL SECTION:
dns-dcxx.hvxx.labipv6.vn. 86400 IN A 192.168.1.100

;; Query time: 0 msec


;; SERVER: 192.168.1.10#53(192.168.1.10)
;; WHEN: Sat Apr 22 00:23:20 ICT 2017
;; MSG SIZE rcvd: 103

[root@localhost ~]#

Case 2: Configure the DNS server to listen for queries on the IPv6 interface.
Step 1: Configuration allows the DNS server to listen for queries on the IPv6 address
interface by adding the following line to the option of the named.conf file.

listen-on-v6 {any; };
45
Content after adding

options {
directory "/var/named";
pid-file "/var/run-named/named.pid";
version "not currently available";
listen-on {any; };
listen-on-v6 {any; };
allow-recursion {127.0.0.1; any; };
allow-query {any; };
};

Step 2: Check if the configuration file named.conf is properly structured.


(Record results)

[root@localhost ~]# /usr/local/sbin/named-checkconf /etc/named.conf


[root@localhost ~]#

Step 3: Restart named, make sure the named process is working.


(Record results)

[root@localhost ~]# ps -ef | grep named


root 14250 1 0 Apr21 ? 00:00:00 /usr/local/sbin/named -c /etc/named.conf
[root@localhost ~]#

Step 4: Query the DNS server (at the IPv6 address of the server) to see if the server is
listening and responding to queries via IPv6.

(Record results)

[root@localhost ~]# dig @2001:dc1::10 www.hvxx.labipv6.vn

; <<>> DiG 9.10.2-P4 <<>> @2001:dc1::10 www.hvxx.labipv6.vn


46
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 59125
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 2

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.hvxx.labipv6.vn. IN A

;; ANSWER SECTION:
www.hvxx.labipv6.vn. 86400 IN A 192.168.1.100

;; AUTHORITY SECTION:
hvxx.labipv6.vn. 86400 IN NS dns-dcxx.hvxx.labipv6.vn.

;; ADDITIONAL SECTION:
dns-dcxx.hvxx.labipv6.vn. 86400 IN A 192.168.1.100

;; Query time: 2 msec


;; SERVER: 2001:dc1::10#53(2001:dc1::10)
;; WHEN: Sat Apr 22 00:13:45 ICT 2017
;; MSG SIZE rcvd: 103

[root@localhost ~]#

Case 3: Declare resource records specific to IPv6.


Situational analysis: When a unit deployed web service, with website is:
http://www.hvxx.labipv6.vn, web content is hosted on a server using IPv6 address: 2001:
dcx :: x,

The task of the DNS admin is to declare the record

www.hvxx.labipv6.vn. IN AAAA 2001:dcx::x

47
In the zone data file /var/named/db.hvxx.labipv6.vn of the zone hvxx.labipv6.vn

Step 1: Use the vi command to add a record to the end of /var/named/db.hvxx.labipv6.vn

www.hvxx.labipv6.vn. IN AAAA 2001:dcx::x;

Note 1: Must have “.” after the domain name to indicate that the domain is full
Note 2: each time change the zone file, have to increase the serial.

[root@localhost ~]# vi /var/named/db.hvxx.labipv6.vn


$TTL 86400;
@ IN SOA dns-dcxx.hvxx.labipv6.vn. hostmaster.hvxx.labipv6.vn. (
2016010503; serial
1800; refresh
900; retry
604800; expiry
5400; minimum negative ttl
);
IN NS dns-dcxx.hvxx.labipv6.vn.
$ORIGIN hvxx.labipv6.vn.
dns-dcxx IN A 192.168.1.100
www IN A 192.168.1.100
www.hv01.labipv6.vn. IN AAAA 2001:dc1::10

Step 2: Check the data file for the hvxx.labipv6.vn zone on the system.
(Record results)
[root@localhost ~]# /usr/local/sbin/named-checkzone hv01.labipv6.vn /var/named/db.hv01.labipv6.vn

zone hv01.labipv6.vn/IN: loaded serial 2016010503

OK

[root@localhost ~]#

Step 3: Restart named, make sure the named process is working.


(Record results)
48
[root@localhost ~]# ps -ef | grep named
root 14250 1 0 Apr21 ? 00:00:00 /usr/local/sbin/named -c /etc/named.conf
[root@localhost ~]# kill -9 14250
[root@localhost ~]# /usr/local/sbin/named -c /etc/named.conf
[root@localhost ~]# ps -ef | grep named
root 14425 1 1 00:20 ? 00:00:00 /usr/local/sbin/named -c /etc/named.conf
[root@localhost ~]#

Step 4: Query the DNS server with the domain name www.hvxx.labipv6.vn and record
type AAAA to check the results.

(Record results)

[root@localhost named]# dig @192.168.1.10 www.hvxx.labipv6.vn +norec AAAA

; <<>> DiG 9.10.2-P4 <<>> @192.168.1.10 www.hvxx.labipv6.vn +norec AAAA


; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 61886
;; flags: qr aa ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 2

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.hvxx.labipv6.vn. IN AAAA

;; ANSWER SECTION:
www.hvxx.labipv6.vn. 86400 IN AAAA 2001:dc1::10

;; AUTHORITY SECTION:
hvxx.labipv6.vn. 86400 IN NS dns-dcxx.hvxx.labipv6.vn.

;; ADDITIONAL SECTION:
dns-dcxx.hvxx.labipv6.vn. 86400 IN A 192.168.1.100
49
;; Query time: 0 msec
;; SERVER: 192.168.1.10#53(192.168.1.10)
;; WHEN: Sat Apr 22 00:58:04 ICT 2017
;; MSG SIZE rcvd: 115

[root@localhost named]# dig @2001:dc1::10 www.hvxx.labipv6.vn +norec AAAA

; <<>> DiG 9.10.2-P4 <<>> @2001:dc1::10 www.hvxx.labipv6.vn +norec AAAA


; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 4683
;; flags: qr aa ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 2

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.hvxx.labipv6.vn. IN AAAA

;; ANSWER SECTION:
www.hvxx.labipv6.vn. 86400 IN AAAA 2001:dc1::10

;; AUTHORITY SECTION:
hvxx.labipv6.vn. 86400 IN NS dns-dcxx.hvxx.labipv6.vn.

;; ADDITIONAL SECTION:
dns-dcxx.hvxx.labipv6.vn. 86400 IN A 192.168.1.100

;; Query time: 0 msec


;; SERVER: 2001:dc1::10#53(2001:dc1::10)
;; WHEN: Sat Apr 22 00:58:10 ICT 2017
;; MSG SIZE rcvd: 115

[root@localhost named]#

50
51
4. Exercise 4: Enable IPv6 in Apache

We verify corectly DNS configuration in Exercise 3 by configure Web service on IPv6.


We use apache.

www.hvxx.labipv6.vn1 : 192.168.x.x

www.hvxx.labipv6.vn1 : 2001:DCx::x

Setup Apache :

#yum install httpd

#service httpd start


Open file httpd.conf

# vi /etc/httpd.conf

Enable service port 80

Listen 192.168.x.x:80

Listen [2001:dcx::x]:80

Save and restart apache

# service httpd restart

Verify Apache process command

# netstat -tulpn | grep :80

tcp 0 0 192.168.x.x:80 0.0.0.0:* LISTEN 4473/httpd


tcp 0 0 2001:dcx::x:80 :::* LISTEN 4473/httpd

Permit http through host firewall

52
# vi /etc/sysconfig/ip6tables

-A RH-Firewall-1-INPUT -m tcp -p tcp --dport 80 -j ACCEPT

Check IPv6 Web service by open browser: http://[2001:dcx::x] or http://


ww.hvxx.labipv6.vn1

53
III. Appendix
1. How to Use the vi Editor
The vi editor is available on almost all Unix systems. vi can be used from any type of
terminal because it does not depend on arrow keys and function keys--it uses the standard
alphabetic keys for commands.

vi (pronounced "vee-eye") is short for "vi"sual editor. It displays a window into the file
being edited that shows 24 lines of text. vi is a text editor, not a "what you see is what
you get" word processor. vi lets you add, change, and delete text, but does not provide
such formatting capabilities as centering lines or indenting paragraphs.

This help note explains the basics of vi:

- opening and closing a file

- moving around in a file

- elementary editing

Starting vi

You may use vi to open an already existing file by typing

vi filename

where "filename" is the name of the existing file. If the file is not in your current
directory, you must use the full pathname.Or you may create a new file by typing

vi newname

where "newname" is the name you wish to give the new file. To open a new file called
"testvi," enter

vi testvi

On-screen, you will see blank lines, each with a tilde (~) at the left, and a line at the
bottom giving the name and status of the new file:

"testvi" [New file]

54
vi has two modes:

- command mode

- insert mode

In command mode, the letters of the keyboard perform editing functions (like moving the
cursor, deleting text, etc.). To enter command mode, press the escape <Esc> key.

In insert mode, the letters you type form words and sentences. Unlike many word
processors, vi starts up in command mode.

Entering Text

In order to begin entering text in this empty file, you must change from command mode
to insert mode. To do this, type i

Nothing appears to change, but you are now in insert mode and can begin typing text. In
general, vi's commands do not display on the screen and do not require the Return key to
be pressed.

Type a few short lines and press <Return> at the end of each line. If you type a long line,
you will notice the vi does not word wrap, it merely breaks the line unceremoniously at
the edge of the screen.

If you make a mistake, pressing <Backspace> or <Delete> may remove the error,
depending on your terminal type.

Moving the Cursor

To move the cursor to another position, you must be in command mode. If you have just
finished typing text, you are still in insert mode. Go back to command mode by pressing
<Esc>. If you are not sure which mode you are in, press <Esc> once or twice until you
hear a beep. When you hear the beep, you are in command mode.

The cursor is controlled with four keys: h, j, k, l.

Key Cursor Movement

--- ---------------

h left one space

55
j down one line

k up one line

l right one space

When you have gone as far as possible in one direction, the cursor stops moving and you
hear a beep. For example, you cannot use l to move right and wrap around to the next
line, you must use j to move down a line. See the section entitled "Moving Around in a
File" for ways to move more quickly through a file.

Basic Editing

Editing commands require that you be command mode. Many of the editing commands
have a different function depending on whether they are typed as upper- or lowercase.
Often, editing commands can be preceded by a number to indicate a repetition of the
command.

Deleting Characters

To delete a character from a file, move the cursor until it is on the incorrect letter, then
type

The character under the cursor disappears. To remove four characters (the one under the
cursor and the next three) type

4x

To delete the character before the cursor, type

X (uppercase)

Deleting Words

To delete a word, move the cursor to the first letter of the word, and type

dw

This command deletes the word and the space following it.

To delete three words type

56
3dw

Deleting Lines

To delete a whole line, type

dd

The cursor does not have to be at the beginning of the line. Typing dd deletes the entire
line containing the cursor and places the cursor at the start of the next line. To delete two
lines, type

2dd

To delete from the cursor position to the end of the line, type

D (uppercase)

Replacing Characters

To replace one character with another:

Move the cursor to the character to be replaced.

Type r

Type the replacement character.

The new character will appear, and you will still be in command mode.

Replacing Words

To replace one word with another, move to the start of the incorrect word and type

cw

The last letter of the word to be replaced will turn into a $. You are now in insert mode
and may type the replacement. The new text does not need to be the same length as the
original. Press <Esc> to get back to command mode. To replace three words, type

3cw

Replacing Lines

To change text from the cursor position to the end of the line:
57
Type C (uppercase).

Type the replacement text.

Press <Esc>.

Inserting Text

To insert text in a line:

Position the cursor where the new text should go.

Type i

Enter the new text.

The text is inserted BEFORE the cursor.

Press <Esc> to get back to command mode.

Appending Text

To add text to the end of a line:

Position the cursor on the last letter of the line.

Type a

Enter the new text.

This adds text AFTER the cursor.

Press <Esc> to get back to command mode.

Opening a Blank Line

To insert a blank line below the current line, type

o (lowercase)

To insert a blank line above the current line, type

O (uppercase)

58
Joining Lines

To join two lines together:

Put the cursor on the first line to be joined.

Type J

To join three lines together:

Put the cursor on the first line to be joined.

Type 3J

Undoing

To undo your most recent edit, type

To undo all the edits on a single line, type

U (uppercase)

Undoing all edits on a single line only works as long as the cursor stays on that line. Once
you move the cursor off a line, you cannot use U to restore the line.

Moving Around in a File

There are shortcuts to move more quickly though a file. All these work in command
mode.

Key Movement

--- --------

w forward word by word

b backward word by word

$ to end of line

0 (zero) to beginning of line

H to top line of screen

59
M to middle line of screen

L to last line of screen

G to last line of file

1G to first line of file

<Control>f scroll forward one screen

<Control>b scroll backward one screen

<Control>d scroll down one-half screen

<Control>u scroll up one-half screen

Moving by Searching

To move quickly by searching for text, while in command mode:

Type / (slash).

Enter the text to search for.

Press <Return>.

The cursor moves to the first occurrence of that text.

To repeat the search in a forward direction, type

To repeat the search in a backward direction, type

Closing and Saving a File

With vi, you edit a copy of the file, rather than the original file. Changes are made to the
original only when you save your edits.

To save the file and quit vi, type

ZZ

60
The vi editor editor is built on an earler Unix text editor called ex. ex commands can be
used within vi. ex commands begin with a : (colon) and end with a <Return>. The
command is displayed on the status line as you type. Some ex commands are useful when
saving and closing files.

To save the edits you have made, but leave vi running and your file open:

Press <Esc>.

Type :w

Press <Return>.

To quit vi, and discard any changes your have made since last saving:

Press <Esc>.

Type :q!

Press <Return>.

Command Summary

STARTING vi

vi filename edit a file named "filename"

vi newfile create a new file named "newfile"

ENTERING TEXT

i insert text left of cursor

a append text right of cursor

MOVING THE CURSOR

h left one space

j down one line

k up one line

l right one space

61
BASIC EDITING

x delete character

nx delete n characters

X delete character before cursor

dw delete word

ndw delete n words

dd delete line

ndd delete n lines

D delete characters from cursor to end of line

r replace character under cursor

cw replace a word

ncw replace n words

C change text from cursor to end of line

o insert blank line below cursor

(ready for insertion)

O insert blank line above cursor

(ready for insertion)

J join succeeding line to current cursor line

nJ join n succeeding lines to current cursor line

u undo last change

U restore current line

MOVING AROUND IN A FILE

w forward word by word

62
b backward word by word

$ to end of line

0 (zero) to beginning of line

H to top line of screen

M to middle line of screen

L to last line of screen

G to last line of file

1G to first line of file

<Control>f scroll forward one screen

<Control>b scroll backward one screen

<Control>d scroll down one-half screen

<Control>u scroll up one-half screen

n repeat last search in same direction

N repeat last search in opposite direction

CLOSING AND SAVING A FILE

ZZ save file and then quit

:w save file

:q! discard changes and quit file

(*Copyright 1991 by Simon Fraser University. Reprinted with permission.)

2. Tài liệu tham khảo

 IPv6 trên Windows XP

https://support.microsoft.com/en-us/kb/2478747

 Cấu hình NAT64 trên Router Cisco


63
https://supportforums.cisco.com/document/112121/ipv6-stateful-nat64-configuration-example

 Tắt bật tính năng IPv6 trong windows

https://support.microsoft.com/vi-vn/help/929852/how-to-disable-ipv6-or-its-components-
in-windows

 So sánh khác biệt OSPFv3 và OSPFv2

https://supportforums.cisco.com/document/97766/comparing-ospfv3-ospfv2-routing-
protocol

64

Вам также может понравиться