ip address を明示的に設定せずに通信するケース
検証内容
・非番号シリアルリンクを使用したOSPF通信
・PPP IPCP により対向のPPPからアドレスをもらう方法



条件
上記の図にてR1 s1/0 - R2 s1/0 のアドレスを明示的に設定せずに通信する

まずは、ip unnumbered を使用した設定を確認します。
参考 http://www.cisco.com/cisco/web/support/JP/100/1007/1007626_ospfdb1-j.html

R1
int s1/0
ip unnumbered s1/1
int s1/1
ip add 192.168.1.1 255.255.255.0

router ospf 1
router-id 1.1.1.1
net 192.168.1.0 0.0.0.255 area 0

R2
int s1/0
ip unnumbered s1/1
int s1/1
ip add 192.168.2.2 255.255.255.0

router ospf 1
router-id 2.2.2.2
net 192.168.2.0 0.0.0.255 area 0

こんなかんじで設定します。
イメージ的には s1/0 のアドレスは s1/1 のアドレスを借用して通信を成り立たせるみたい。

sh ip route を見るとお互いのネットワークへ接続できることがわかります。
コストは 128 なので、unnumbered の区間も 64 で計算されていることがわかります。

R1
     1.0.0.0/32 is subnetted, 1 subnets
C       1.1.1.1 is directly connected, Loopback0
C    192.168.1.0/24 is directly connected, Serial1/1
O    192.168.2.0/24 [110/128] via 192.168.2.2, 00:07:03, Serial1/0

R2
     2.0.0.0/32 is subnetted, 1 subnets
C       2.2.2.2 is directly connected, Loopback0
O    192.168.1.0/24 [110/128] via 192.168.1.1, 00:08:23, Serial1/0
C    192.168.2.0/24 is directly connected, Serial1/1
また、sh ip ospf interface を見ると、ip address は 0.0.0.0 になっていることがわかりますね。

R1
# sh ip ospf interface s1/0
Serial1/0 is up, line protocol is up
  Internet Address 0.0.0.0/0, Area 0
  Process ID 1, Router ID 1.1.1.1, Network Type POINT_TO_POINT, Cost: 64
  Transmit Delay is 1 sec, State POINT_TO_POINT,
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    oob-resync timeout 40
    Hello due in 00:00:02
  Supports Link-local Signaling (LLS)
  Index 1/1, flood queue length 0
  Next 0x0(0)/0x0(0)
  Last flood scan length is 1, maximum is 1
  Last flood scan time is 0 msec, maximum is 4 msec
  Neighbor Count is 1, Adjacent neighbor count is 1
    Adjacent with neighbor 2.2.2.2
  Suppress hello for 0 neighbor(s)


はい。次は PPP IPCP の設定ですが、下記のような構成で検証してみます。
R1側のs1/0では明示的に 12.12.12.1/24のアドレスを指定しますが、R2側のs1/0インタフェース
では明示的に設定せずに PPP IPCP を用いて対向の PPP からアドレスをもらうよう設定します。



とりあえず下記のように設定してみます。

R1
username R2-CHAP password 0 cisco

ip local pool R2-PPP 12.12.12.2

int s1/0
ip add 12.12.12.1 255.255.255.0
encap ppp
peer default ip address pool R2-PPP
ppp authentication chap
ppp chap hostname R1-CHAP
int s1/1
ip add 192.168.1.1 255.255.255.0

router ospf 1
router-id 1.1.1.1
net 192.168.1.0 0.0.0.255 area 0
net 12.12.12.1 0.0.0.0 area 0

R2
username R1-CHAP password 0 cisco

int s1/0
ip address negotiated
encap ppp ppp authentication chap
ppp chap hostname R2-CHAP
int s1/1
ip add 192.168.2.2 255.255.255.0

router ospf 1
router-id 2.2.2.2
net 192.168.2.0 0.0.0.255 area 0
net 12.12.12.2 0.0.0.0 area 0


まず PPP の確立としては、

username [相手のhostname] password 0 [パスワード]

インターフェースモードで、

encapslation ppp
ppp authentication chap
ppp chap hostname [chap用のhostname]

ですね。ppp chap hostname を入れない場合は、ルータの hostname が適用されます。

対向からアドレスをもらう設定としては

【あげる側】
ip local pool [プール名] [あげるアドレス]

インターフェースモードで、

peer default ip address pool [プール名]

【もらう側】
インターフェースモードで、

ip address negotiated


ってかんじです。
これで、もらう側の sh int をみてみると、 LCPがopenとなっておりPPPが確立されていることがわかり、 またアドレス 12.12.12.2 をもらっていることがわかります。

R2#sh int s1/0
Serial1/0 is up, line protocol is up
  Hardware is M8T-X.21
  Internet address is 12.12.12.2/32
  MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec,
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation PPP, LCP Open
  Open: IPCP, CDPCP, crc 16, loopback not set
  Keepalive set (10 sec)
  Restart-Delay is 0 secs
  Last input 00:00:05, output 00:00:01, output hang never
  Last clearing of "show interface" counters 01:23:25
  Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
  Queueing strategy: weighted fair
  Output queue: 0/1000/64/0 (size/max total/threshold/drops)
     Conversations  0/2/256 (active/max active/max total)
     Reserved Conversations 0/0 (allocated/max allocated)
     Available Bandwidth 1158 kilobits/sec
  5 minute input rate 0 bits/sec, 0 packets/sec
  5 minute output rate 0 bits/sec, 0 packets/sec
     1446 packets input, 77123 bytes, 0 no buffer
     Received 0 broadcasts, 0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
     1457 packets output, 83224 bytes, 0 underruns


しかし、困ったことに R1側は /24 の体系なのに R2 は /32 になっちゃってますね。
おれが原因と思いますが、sh ip ospf nei でネイバーが確立されていません。


R1#sh ip ospf nei

Neighbor ID     Pri   State           Dead Time   Address         Interface
192.168.1.3       0   FULL/  -        00:00:38    192.168.1.3     Serial1/1
2.2.2.2           0   INIT/  -        00:00:34    12.12.12.2      Serial1/0

R2#sh ip ospf nei

R2#


ちゃんとpingはとぶので、スタティックルートを設定すれば他ネットワークとも
疎通は可能でしたが、OSPFをコンバージェンスすることはできないようです。(多分)

IPCPにて対向にmaskも教えてあげるコマンドはあります。

【あげる側】
interface s1/0
ppp ipcp mask 255.255.255.0

【もらう側】
inteface s1/0
ppp ipcp mask request


しかし、これを設定してもうまくいかないんですよねぇ。なんでだろ。


/24 でアドレスをもらうにはDHCP使わないとって、下記のサイトには書いてありますね。
http://www41375u.sakura.ne.jp/network/cisco_layer2/ppp.html#53
ということでDHCP 用の設定が下記です。

R1
username R2-CHAP password 0 cisco

ip local pool R2-PPP 12.12.12.2

int s1/0
ip add 12.12.12.1 255.255.255.0
encap ppp
peer default ip address pool R2-PPP
ppp authentication chap
ppp chap hostname R1-CHAP
ppp ipcp mask 255.255.255.0
int s1/1
ip add 192.168.1.1 255.255.255.0

router ospf 1
router-id 1.1.1.1
net 192.168.1.0 0.0.0.255 area 0
net 12.12.12.1 0.0.0.0 area 0

R2
username R1-CHAP password 0 cisco

ip dhcp pool DHCP
origin ipcp
import all

int s1/0
ip address pool DHCP
encap ppp ppp authentication chap
ppp chap hostname R2-CHAP
ppp ipcp mask request
int s1/1
ip add 192.168.2.2 255.255.255.0

router ospf 1
router-id 2.2.2.2
net 192.168.2.0 0.0.0.255 area 0
net 12.12.12.2 0.0.0.0 area 0


アドレスをもらう側のルータで DHCP プールを作ってやって
origin ipcp なんてことができるんですね。
で、インターフェースで ip address pool [プール名] とやると。。

あとはあげる側のルータのインターフェースで、

ppp ipcp mask [サブネットマスク]

もらう側のルータのインターフェースで、

ppp ipcp mask request

とやることで、マスクも一緒にもらえますと。。よくできてる。

sh int s1/0 でマスクが/24 でもらえていることがわかりますね

R2#sh int s1/0
Serial1/0 is up, line protocol is up
  Hardware is M8T-X.21
  Internet address is 12.12.12.2/24
  MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec,
     reliability 255/255, txload 1/255, rxload 1/255


ちなみに蛇足ですが、ppp セッションを張ると自分のルーティングテーブルに
対向インターフェースのホストアドレスが載ります。


R1#sh ip route
Gateway of last resort is not set

     1.0.0.0/32 is subnetted, 1 subnets
C       1.1.1.1 is directly connected, Loopback0
     12.0.0.0/8 is variably subnetted, 3 subnets, 3 masks
C       12.12.0.0/16 is directly connected, Serial1/0
O       12.12.12.0/30 [110/128] via 12.12.12.2, 00:03:48, Serial1/0
C       12.12.12.2/32 is directly connected, Serial1/0
C    192.168.1.0/24 is directly connected, Serial1/1
S    192.168.2.0/24 [1/0] via 12.12.12.2


このルートはppp以外ではでてこないルートなので他のプロトコルなどと組み合わせたり
すると問題は発生する可能性があります。このルートを消す方法は下記のコマンドです。

no peer neighbor-route

これを入れると下記のように相手のホストルートが消えます。


R1#sh ip route
Gateway of last resort is not set

     1.0.0.0/32 is subnetted, 1 subnets
C       1.1.1.1 is directly connected, Loopback0
     12.0.0.0/8 is variably subnetted, 3 subnets, 3 masks
C       12.12.0.0/16 is directly connected, Serial1/0
O       12.12.12.0/30 [110/128] via 12.12.12.2, 00:03:48, Serial1/0
C    192.168.1.0/24 is directly connected, Serial1/1
S    192.168.2.0/24 [1/0] via 12.12.12.2


ホストルートの問題としては、下記とか。ppp は関係ないかもだけど。
http://www.cisco.com/cisco/web/support/JP/100/1000/1000218_dcprob.html

更新日:2012/8/5