2015年11月29日日曜日

.1Qイン.1Q ACLからDHCPまで

いつもお世話になっているイージスさんから。

IEEE802.1q トンネリング
ダブルタグ

なる手法のお話。WANサービスについて部分的に言及なさっているが、キャリアの仕様がユーザに明かされることはないので、詳細は、当該サービスの関係者でないと知りようがない。誤3 blog 程度なここでは無縁の世界。

ただ、毎度毎度の乱筆メモの程度で書くなら。

・IEEE802.1ad
・スタックするので1522オーバーの対応必須
・トンネリングとはいってもカプセル化はしてない
・現在は MAC in MAC のさらに先

メモ錯ではないWebコンテンツはこちら。

IEEE802.1adについて NTTから
http://www.ntt.co.jp/journal/0601/files/jn200601054.pdf

Road to ネットワークスペシャリスト
http://ipnetwork.web.fc2.com/spb/spbm.html


さておきACL。

・試験における格言らしき
標準ACLは宛先に近い場所に設定、拡張ACLは送信元に近い場所に設定するのが推奨

お作法というやつ。

・ワイルドカードの解説は厳密には…

厳密に書こうとしたら恐ろしく面倒、且つ教えた/おぼえたところで全く実践的でないという点でたいへんに共感。

 ・番号付き拡張ACLは100-199と2000-2699

2000番台は書いたことがない、2000-2699か。

 ・gt と lt そして neq と range

gt は何かで書いたおぼえがうっすらと。range は けっこう機会があった。neq は自分が設定どうこう以前に、目にしたことさえただの一度もない。

・established は RSTパケットも対象。

知らんかった。。。


・名前付き拡張ACLのシーケンス番号は10,20…

名前付きを一から書いたことがないので練習。

Router-ACL(config)#ip access-list ?
  extended    Extended Access List
  helper      Access List acts on helper-address
  log-update  Control access list log updates
  logging     Control access list logging
  resequence  Resequence Access List
  standard    Standard Access List

Router-ACL(config)#ip access-list ex
Router-ACL(config)#ip access-list extended tutorial
Router-ACL(config-ext-nacl)#permit tcp 172.16.1.0 0.0.0.255 any neq 445 established log

(略)


番号は accesss-list うんちゃらだが、名前付きは ip access-list extentedである点も知らなかった。

・show プロトコル access-list
・show interfaceから見るACL状況

・拡張アクセスリスト(番号)に挿入可能
・ip access-list extented から no sequence-number で部分削除も可能

・access-class をアウトバウンドで使用すると宛先のチェックになる!!!


自分が浅はか過ぎていろいろヤバイ。。


DHCPについて

Discover
Offer
Request
ACK

クライアントはブロードキャスト、サーバはユニキャスト。当たり前のことだが「えっと」 と間を置かないと出てこない時点でショボイ。


・DHCPはコンフィグに見えないがserviceとして扱われている

L3-PrivateVLAN(config)#no service ?
  compress-config        Compress the configuration file
  config                 TFTP load config files
  dhcp                   Enable DHCP server and relay agent
  disable-ip-fast-frag   Disable IP particle-based fast fragmentation
  exec-callback          Enable exec callback
  exec-wait              Delay EXEC startup on noisy lines
  finger                 Allow responses to finger requests
  hide-telnet-addresses  Hide destination addresses in telnet command
  linenumber             enable line number banner for each exec
  nagle                  Enable Nagle's congestion control algorithm
  old-slip-prompts       Allow old scripts to operate with slip/ppp
  pad                    Enable PAD commands
  password-encryption    Encrypt system passwords
  password-recovery      Disable password recovery
  prompt                 Enable mode specific prompt
  pt-vty-logging         Log significant VTY-Async events
  sequence-numbers       Stamp logger messages with a sequence number
  slave-log              Enable log capability of slave IPs
  tcp-keepalives-in      Generate keepalives on idle incoming network
                         connections
  tcp-keepalives-out     Generate keepalives on idle outgoing network
                         connections
  tcp-small-servers      Enable small TCP servers (e.g., ECHO)
  telnet-zeroidle        Set TCP window 0 when connection is idle
  timestamps             Timestamp debug/log messages
  udp-small-servers      Enable small UDP servers (e.g., ECHO)

L3-PrivateVLAN(config)#no service


Router(config)#no service ?
  alignment              Control alignment correction and logging
  call-home              Enable call-home service
  compress-config        Compress the nvram configuration file
  config                 TFTP load config files
  counters               Control aging of interface counters
  dhcp                   Enable DHCP server and relay agent
  disable-ip-fast-frag   Disable IP particle-based fast fragmentation
  exec-callback          Enable exec callback
  exec-wait              Delay EXEC startup on noisy lines
  finger                 Allow responses to finger requests
  hide-telnet-addresses  Hide destination addresses in telnet command
  linenumber             enable line number banner for each exec
  nagle                  Enable Nagle's congestion control algorithm
  old-slip-prompts       Allow old scripts to operate with slip/ppp
  pad                    Enable PAD commands
  password-encryption    Encrypt system passwords
  prompt                 Enable mode specific prompt
  pt-vty-logging         Log significant VTY-Async events
  sequence-numbers       Stamp logger messages with a sequence number
  slave-log              Enable log capability of slave IPs
  tcp-keepalives-in      Generate keepalives on idle incoming network
                         connections
  tcp-keepalives-out     Generate keepalives on idle outgoing network
                         connections
  tcp-small-servers      Enable small TCP servers (e.g., ECHO)
  telnet-zeroidle        Set TCP window 0 when connection is idle
  timestamps             Timestamp debug/log messages
  udp-small-servers      Enable small UDP servers (e.g., ECHO)

Router(config)#no service


・設定の解説にあたっては除外アドレスから始める


さぞトラブルがあったことだろうとお察しを。


入力のお作法の確認。

L2-QoS(config)#ip dhcp ?
  conflict                   DHCP address conflict parameters
  database                   Configure DHCP database agents
  excluded-address           Prevent DHCP from assigning certain addresses
  limited-broadcast-address  Use all 1's broadcast address
  ping                       Specify ping parameters used by DHCP
  pool                       Configure DHCP address pools
  relay                      DHCP relay agent parameters
  smart-relay                Enable Smart Relay feature
  snooping                   DHCP Snooping

L2-QoS(config)#ip dhcp excluded-address ?
  A.B.C.D  Low IP address

L2-QoS(config)#ip dhcp excluded-address 172.17.1.254 172.18.1.2


ここで、excluded設定についてもお作法を試したところ、running-config にこのような結果が。

!
no aaa new-model
clock timezone JST 9
vtp domain vtptest
vtp mode transparent
ip subnet-zero
ip routing
ip dhcp excluded-address 10.0.0.0 10.255.255.255
ip dhcp excluded-address 10.0.0.1 10.255.255.254
ip dhcp excluded-address 11.0.0.0 11.255.255.255
ip dhcp excluded-address 172.16.0.1 172.31.255.254
ip dhcp excluded-address 192.168.0.1 192.168.1.254
ip dhcp excluded-address 0.0.0.1 127.255.255.254
ip dhcp excluded-address 128.0.0.1 191.255.255.254
ip dhcp excluded-address 192.0.0.1 223.255.255.254
ip dhcp excluded-address 224.0.0.1 239.255.255.254
ip dhcp excluded-address 240.0.0.1 255.255.255.254
ip dhcp excluded-address 127.255.255.254 128.0.0.1
ip dhcp excluded-address 191.255.255.254 192.0.0.1
ip dhcp excluded-address 223.255.255.254 224.0.0.1
ip dhcp excluded-address 239.255.255.254 240.0.0.1
!
!

グローバル/プライベートやクラス境界、特殊なアドレス問わず設定可能。また、

L2-QoS(config)#ip dhcp pool TEST
L2-QoS(dhcp-config)#network 172.16.32.0 255.255.255.0
L2-QoS(dhcp-config)#default-router 172.16.31.1
L2-QoS(dhcp-config)#domain-name test.local
L2-QoS(dhcp-config)#lease 1 12
L2-QoS(dhcp-config)#exit
L2-QoS(config)#
L2-QoS(config)#no ip dhcp conflict logging
L2-QoS(config)#


実在するサブネットは、プライベートVLANの学習の際にテストしたVLAN 31、172.16.31.0/24。一方で設定上は実在しないサブネットでも入るし、もっとあからさまにメチャクチャな値でも入ることは入る。もちろん誤動作はしないので、作業場の間違いが起こりうる、というだけのこと。



次にDHCPデータベースの設定について。

L2-QoS(config)# ip dhcp database?
database

L2-QoS(config)# ip dhcp database ?
  WORD  Uniform Resource Locator (URL)

L2-QoS(config)#ip dhcp database TESTURL ?
  timeout      Set the database transfer timeout
  write-delay  Set the database write delay
  <cr>

L2-QoS(config)#ip dhcp database TESTURL write-delay ?
  <60-4294967295>  Seconds

L2-QoS(config)#

この機能の意義について全くわかっちゃいないので、ここでは、設定上はこんなやわ、という程度で。


ここで、先ほどの設定ミス事例を一部修正。

L2-QoS(config)#ip dhcp pool TEST
L2-QoS(dhcp-config)#
L2-QoS(dhcp-config)#network 172.16.31.0 255.255.255.0
L2-QoS(dhcp-config)#exit
L2-QoS(config)#
L2-QoS(config)#
L2-QoS(config)#ip dhcp excluded-address 172.16.31.1 172.16.31.127
L2-QoS(config)#ip dhcp excluded-address 172.16.31.144 172.16.31.255
L2-QoS(config)#

networkで本来のサブネットを追加した。誤った設定も残したままだが、アドレス授受は完了した。


L2-QoS#show ip dhcp ?
  binding   DHCP address bindings
  conflict  DHCP address conflicts
  database  DHCP database agents
  import    Show Imported Parameters
  relay     Miscellaneous DHCP relay information
  server    Miscellaneous DHCP server information
  snooping  DHCP snooping

L2-QoS#show ip dhcp binding
IP address       Client-ID/              Lease expiration        Type
                 Hardware address
172.16.31.128    (MACアドレス)       Mar 02 1993 11:21 PM    Automatic
L2-QoS#
L2-QoS#
L2-QoS#show ip dhcp conflict
IP address        Detection method   Detection time
L2-QoS#
L2-QoS#show ip dhcp database

L2-QoS#
L2-QoS#show ip dhcp import

L2-QoS#
L2-QoS#show ip dhcp relay
% Incomplete command.

L2-QoS#show ip dhcp relay ?
  information  DHCP relay information option

L2-QoS#show ip dhcp relay information
% Incomplete command.

L2-QoS#show ip dhcp relay information  ?
  trusted-sources  List of trusted sources of relay information option

L2-QoS#show ip dhcp relay information  trusted-sources ?
  |  Output modifiers
  <cr>

L2-QoS#show ip dhcp relay information  trusted-sources
List of trusted sources of relay agent information option:

L2-QoS#show ip dhcp server
% Incomplete command.

L2-QoS#show ip dhcp server ?
  statistics  DHCP server statistics

L2-QoS#show ip dhcp server statistics
Memory usage         5180
Address pools        1
Database agents      0
Automatic bindings   1
Manual bindings      0
Expired bindings     0
Malformed messages   0

Message              Received
BOOTREQUEST          0
DHCPDISCOVER         23
DHCPREQUEST          1
DHCPDECLINE          0
DHCPRELEASE          0
DHCPINFORM           0

Message              Sent
BOOTREPLY            0
DHCPOFFER            1
DHCPACK              1
DHCPNAK              0
L2-QoS#
L2-QoS#
L2-QoS#show ip dhcp snooping ?
  binding   DHCP snooping bindings
  database  DHCP snooping database agent
  |         Output modifiers
  <cr>

L2-QoS#show ip dhcp snooping
Switch DHCP snooping is disabled
DHCP snooping is configured on following VLANs:
none
Insertion of option 82 is enabled
Option 82 on untrusted port is not allowed
Verification of hwaddr field is enabled
Interface                    Trusted     Rate limit (pps)
------------------------     -------     ----------------
L2-QoS#


別の機器では、


Router#show dhcp ?
  lease   Show DHCP Addresses leased from a server
  server  Show DHCP Servers we know about


Router#show dhcp lease
Router#
Router#
Router#show dhcp server
   DHCP server: ANY (255.255.255.255)
    Leases:   0
    Offers:   0      Requests: 0     Acks : 0     Naks: 0
    Declines: 0      Releases: 0     Query: 0     Bad: 0
    Forcerenews: 0      Failures: 0

Router#
Router#
Router#show ip dhcp ?
  binding   DHCP address bindings
  conflict  DHCP address conflicts
  database  DHCP database agents
  import    Show Imported Parameters
  pool      DHCP pools information
  relay     Miscellaneous DHCP relay information
  server    Miscellaneous DHCP server information

Router#show ip dhcp binding
Bindings from all pools not associated with VRF:
IP address          Client-ID/              Lease expiration        Type
                    Hardware address/
                    User name
Router#
Router#
Router#show ip dhcp conflict
IP address        Detection method   Detection time          VRF
Router#
Router#
Router#show ip dhcp database
Router#
Router#
Router#show ip dhcp import
Router#
Router#
Router#show ip dhcp pool
Router#
Router#
Router#show ip dhcp relay
% Incomplete command.

Router#show ip dhcp relay ?
  information  DHCP relay information option

Router#show ip dhcp relay information
% Incomplete command.

Router#show ip dhcp relay information  ?
  trusted-sources  List of trusted sources of relay information option

Router#show ip dhcp relay information  trusted-sources
List of trusted sources of relay agent information option:

Router#show ip dhcp server
% Incomplete command.

Router#show ip dhcp server ?
  statistics  DHCP server statistics

Router#show ip dhcp server statistics
Memory usage         0
Address pools        0
Database agents      0
Automatic bindings   0
Manual bindings      0
Expired bindings     0
Malformed messages   0
Secure arp entries   0

Message              Received
BOOTREQUEST          0
DHCPDISCOVER         0
DHCPREQUEST          0
DHCPDECLINE          0
DHCPRELEASE          0
DHCPINFORM           0

Message              Sent
BOOTREPLY            0
DHCPOFFER            0
DHCPACK              0
DHCPNAK              0
Router#


2015年11月28日土曜日

プライベートVLAN

プライマリVLANとセカンダリVLANから成り、

セカンダリVLANはさらにアイソレーテッドVLANとコミュニティVLANから成る。


…トンミヒルトネン!?!!!
(Tommi Hiltunen - Jarkko Niem)


さておき、これらのVLANが使用するポート

 プライマリVLANは promiscuous ポート
 http://ejje.weblio.jp/content/promiscuous

 セカンダリでアイソレーテッドなVLANは isolated ポート

 セカンダリでコミュニティなVLANは community ポート


を使うとのこと。ようけわからんので設定してみる。


VLAN ID の30番台をプライベートVLANにしてみる。

 31は隔離者や閉鎖的コミュ中毒者が入り乱れる混合ポート…外部出入り口

 35は隔離者VLAN
 39は閉鎖的アタシのイエスマンコミュ中毒者向けVLAN


(config)#vlan 31
L2-QoS(config-vlan)#?
VLAN configuration commands:
  are           Maximum number of All Route Explorer hops for this VLAN (or
                zero if none specified)
  backupcrf     Backup CRF mode of the VLAN
  bridge        Bridging characteristics of the VLAN
  exit          Apply changes, bump revision number, and exit mode
  media         Media type of the VLAN
  mtu           VLAN Maximum Transmission Unit
  name          Ascii name of the VLAN
  no            Negate a command or set its defaults
  parent        ID number of the Parent VLAN of FDDI or Token Ring type VLANs
  private-vlan  Configure a private VLAN
  remote-span   Configure as Remote SPAN VLAN
  ring          Ring number of FDDI or Token Ring type VLANs
  said          IEEE 802.10 SAID
  shutdown      Shutdown VLAN switching
  state         Operational state of the VLAN
  ste           Maximum number of Spanning Tree Explorer hops for this VLAN (or
                zero if none specified)
  stp           Spanning tree characteristics of the VLAN
  tb-vlan1      ID number of the first translational VLAN for this VLAN (or
                zero if none)
  tb-vlan2      ID number of the second translational VLAN for this VLAN (or
                zero if none)

L2-QoS(config-vlan)#private-vlan ?
  association  Configure association between private VLANs
  community    Configure the VLAN as a community private VLAN
  isolated     Configure the VLAN as an isolated private VLAN
  primary      Configure the VLAN as a primary private VLAN

L2-QoS(config-vlan)#private-vlan primary ?
  <cr>

L2-QoS(config-vlan)#private-vlan primary
Private VLANs can only be configured when VTP is in transparent mode.

L2-QoS(config-vlan)#


interface vlan でなくて vlan直 というのがまぎらわしい。

とりあえず、VTP を transparent モードにする。
L2-QoS(config-vlan)#exit
L2-QoS(config)#
L2-QoS(config)#vtp ?
  domain     Set the name of the VTP administrative domain.
  file       Configure IFS filesystem file where VTP configuration is stored.
  interface  Configure interface as the preferred source for the VTP IP updater
             address.
  mode       Configure VTP device mode
  password   Set the password for the VTP administrative domain
  pruning    Set the adminstrative domain to permit pruning
  version    Set the adminstrative domain to VTP version

L2-QoS(config)#vtp mode transparent
Setting device to VTP TRANSPARENT mode.
L2-QoS(config)#

変更終了。

ひとつ前に戻って、VLAN31をプロミスキャス、VLAN35をアイソレーテッド、VLAN39をコミュニティに設定。ここでプライマリVLANとセカンダリVLANの概念を思い出す必要があって

 プライマリ…プロミスキャス

 セカンダリ…アイソレーテッドとコミュニティ


であって、セカンダリの二つはプロミスキャスを介さないと外部と通信できないのでプライマリVLANに所属させなければいけないということに。



L2-QoS(config)#
L2-QoS(config)#vlan 31
L2-QoS(config-vlan)#private-vlan association ?
  WORD    VLAN IDs of the private VLANs to be configured
  add     Add a VLAN to private VLAN list
  remove  Remove a VLAN from private VLAN list

L2-QoS(config-vlan)#private-vlan association add ?
  WORD  VLAN IDs of the private VLANs to be configured

L2-QoS(config-vlan)#private-vlan association add 35,39
L2-QoS(config-vlan)#
L2-QoS(config-vlan)#exit


次に、セカンダリ側での設定は必要ないのか試してみると、



L2-QoS(config)#vlan 35
L2-QoS(config-vlan)#private-vlan association ?
  WORD    VLAN IDs of the private VLANs to be configured
  add     Add a VLAN to private VLAN list
  remove  Remove a VLAN from private VLAN list

L2-QoS(config-vlan)#private-vlan association add 36-38
Command rejected: invalid private vlan association between vlan35 and vlan36. VLAN 35 is not a primary VLAN.
L2-QoS(config-vlan)#
L2-QoS(config-vlan)#
L2-QoS(config-vlan)#private-vlan association add 31
Command rejected: invalid private vlan association between vlan35 and vlan31. VLAN 31 is a primary VLAN.
L2-QoS(config-vlan)#private-vlan association Kakuri-VLAN
Command Rejected: invalid VLAN list

L2-QoS(config-vlan)#

invalid assciation に invalid VLANリストと。



続いて、物理ポートの割り当て。

L2-QoS(config)#interface FastEthernet 0/31
L2-QoS(config-if)#switchport mode ?
  access        Set trunking mode to ACCESS unconditionally
  dot1q-tunnel  set trunking mode to TUNNEL unconditionally
  dynamic       Set trunking mode to dynamically negotiate access or trunk mode
  private-vlan  Set the mode to private-vlan host or promiscuous
  trunk         Set trunking mode to TRUNK unconditionally

L2-QoS(config-if)#switchport mode private-vlan ?
  host         Set the mode to private-vlan host
  promiscuous  Set the mode to private-vlan promiscuous

L2-QoS(config-if)#switchport mode private-vlan promiscuous ?
  <cr>

L2-QoS(config-if)#switchport mode private-vlan promiscuous
L2-QoS(config-if)#
L2-QoS(config-if)#switchport ?
  access         Set access mode characteristics of the interface
  backup         Set backup for the interface
  block          Disable forwarding of unknown uni/multi cast addresses
  host           Set port host
  mode           Set trunking mode of the interface
  nonegotiate    Device will not engage in negotiation protocol on this
                 interface
  port-security  Security related command
  priority       Set appliance 802.1p priority
  private-vlan   Set the private VLAN configuration
  protected      Configure an interface to be a protected port
  trunk          Set trunking characteristics of the interface
  voice          Voice appliance attributes
  <cr>

L2-QoS(config-if)#switchport private-vlan ?
  association       Set the private VLAN association
  host-association  Set the private VLAN host association
  mapping           Set the private VLAN promiscuous mapping

L2-QoS(config-if)#switchport private-vlan association ?
  host     Set the private VLAN host association
  mapping  Set the private VLAN promiscuous mapping

L2-QoS(config-if)#switchport private-vlan ?
  association       Set the private VLAN association
  host-association  Set the private VLAN host association
  mapping           Set the private VLAN promiscuous mapping

L2-QoS(config-if)#switchport private-vlan mapping ?
  <1006-4094>  Primary extended range VLAN ID of the private VLAN promiscuous
               port mapping
  <2-1001>     Primary normal range VLAN ID of the private VLAN promiscuous
               port mapping

L2-QoS(config-if)#switchport private-vlan mapping 31 ?
  WORD    Secondary VLAN IDs of the private VLAN promiscuous port mapping
  add     Add a VLAN to private VLAN list
  remove  Remove a VLAN from private VLAN list

L2-QoS(config-if)#switchport private-vlan mapping 31 add ?
  WORD  Secondary VLAN IDs of the private VLAN promiscuous port mapping

L2-QoS(config-if)#switchport private-vlan mapping 31 add 35,39


これでプライマリ/プロミスキャスの設定は終わり!? 次に、セカンダリ/アイソレーテッドの割り当て。

L2-QoS(config-if)#interface FastEthernet 0/35
L2-QoS(config-if)#
L2-QoS(config-if)#switchport mode private-vlan host
L2-QoS(config-if)#switchport private-vlan ?
  association       Set the private VLAN association
  host-association  Set the private VLAN host association
  mapping           Set the private VLAN promiscuous mapping

L2-QoS(config-if)#switchport private-vlan mapping 31 add 35
L2-QoS(config-if)#


続いてセカンダリ/コミュニティのポート割り当ては、アイソレーテッドと同一。


結果的に running-config に表れるところとしては、

VLAN周り

!
vlan 31
  private-vlan primary
  private-vlan association 35,39
!
vlan 32-34
!
vlan 35
  private-vlan isolated
!
vlan 36-38
!
vlan 39
  private-vlan community
!
vlan 40-136
!
!

インターフェース周り

!
interface FastEthernet0/31
 switchport private-vlan mapping 31 35,39
 switchport mode private-vlan promiscuous
!
interface FastEthernet0/32
!
interface FastEthernet0/33
!
interface FastEthernet0/34
!
interface FastEthernet0/35
 switchport private-vlan host-association 31 35
 switchport mode private-vlan host
!
interface FastEthernet0/36
 switchport private-vlan host-association 31 35
 switchport mode private-vlan host
!
interface FastEthernet0/37
!
interface FastEthernet0/38
!
interface FastEthernet0/39
 switchport private-vlan host-association 31 39
 switchport mode private-vlan host
!
interface FastEthernet0/40
 switchport private-vlan host-association 31 39
 switchport mode private-vlan host
!


さらに、SVIへのマッピングのところ。

L2-QoS(config)#interface vlan 31
L2-QoS(config-if)#
L2-QoS(config-if)#private-vlan mapping ?
  WORD    Secondary VLAN IDs of the private VLAN SVI interface mapping
  add     Add a VLAN to private VLAN list
  remove  Remove a VLAN from private VLAN list

L2-QoS(config-if)#private-vlan mapping add 35,39
L2-QoS(config-if)#
L2-QoS(config-if)#
*Mar  1 14:39:54.063: %PV-6-PV_MSG: Created a private vlan mapping, Primary 31, Secondary 35
*Mar  1 14:39:54.063: %PV-6-PV_MSG: Created a private vlan mapping, Primary 31, Secondary 39
L2-QoS(config-if)#
L2-QoS(config-if)#end
L2-QoS#


running-config 上に追加で表れるところ。


インターフェースVLAN周りで

interface Vlan1
 ip address 172.16.1.1 255.255.255.0
!
interface Vlan31
 no ip address
 private-vlan mapping 35,39
!

とりあえずここまで。





2015年11月27日金曜日

Cisco単独仕様な音声VLANのあたりから

Cisco様の下僕に加えていただいてない私にはまだ理解できない点が

「Cisco音声VLAN 以下の Cisco IP Phone では
  CDP により VLAN と QoS を受けることができる。

太字にするところが違いましたね。「CDP で QoS」 がまだ理解できません。CDPでVLAN、についてはそれでもいくらかお察しもつくのですが。

さておき昨日のおさらいから。

L2-QoS(config)#mls ?
  qos  qos keyword

L2-QoS(config)#mls qos
L2-QoS(config)#
L2-QoS(config)#interface range FastEthernet 0/5 - 6
L2-QoS(config-if-range)#mls ?
  qos  qos command keyword

L2-QoS(config-if-range)#mls
L2-QoS(config-if-range)#mls qos ?
  cos            cos keyword
  dscp-mutation  dscp-mutation keyword
  trust          trust keyword
  vlan-based     vlan-based keyword

L2-QoS(config-if-range)#mls qos trust ?
  cos            cos keyword
  device         trusted device class
  dscp           dscp keyword
  ip-precedence  ip-precedence keyword
  <cr>

L2-QoS(config-if-range)#mls qos trust cos
L2-QoS(config-if-range)#
L2-QoS(config-if-range)#end

基本的な識別についてここまで。


続いて「音声VLANの設定」の部分。まず、インターフェースにおける switchport コマンドのオプションをざっと。

L2-QoS(config-if-range)#switchport ?
  access         Set access mode characteristics of the interface
  backup         Set backup for the interface
  block          Disable forwarding of unknown uni/multi cast addresses
  host           Set port host
  mode           Set trunking mode of the interface
  nonegotiate    Device will not engage in negotiation protocol on this
                 interface
  port-security  Security related command
  priority       Set appliance 802.1p priority
  private-vlan   Set the private VLAN configuration
  protected      Configure an interface to be a protected port
  trunk          Set trunking characteristics of the interface
  voice          Voice appliance attributes
  <cr>

L2-QoS(config-if-range)#

voice のオプションは、Voice あpらいあんす 属性sな設定とのこと。音声や広義の音声トラフィックのためではなく、シスコ電話機商売のための属性オプションという意味であるので誤解があってはならない。


L2-QoS(config-if-range)#switchport voice ?
  vlan  Vlan for voice traffic

L2-QoS(config-if-range)#switchport voice vlan ?
  <1-4094>  Vlan for voice traffic
  dot1p     Priority tagged on PVID
  none      Don't tell telephone about voice vlan
  untagged  Untagged on PVID

L2-QoS(config-if-range)#switchport voice vlan dot1p ?
  <cr>

L2-QoS(config-if-range)#switchport voice vlan dot1p
L2-QoS(config-if-range)#


Ciscoイージスさんの説明だと、

VLAN 指定のVLAN ID
dot1p VLAN ID 0 (ネイティブVLAN)
none タグ無しでCisco IP Phone独自設定
untagged タグ無し ということはCisco IP Phone独自じゃないということで?

ということだが。dot1p でCoS値はどうなる? まだ概要さえ把握できない現在ジブン。

それから、none 設定はrunnning-configには表示されないようだ。


CoS値は扱いがさまざまであるようで、キモオタに媚び気味なアプレシアシリーズだとこういったマッピングも。
http://www.apresia.jp/products/apresialight/configuration/qos/index1.html


それにしても、このblogはますます。

Can you please rephrase your question with examples?

要反省だ。



次は単語メモ。

acronym
http://ejje.weblio.jp/content/acronym



Switch Virtual Interface のあたりから

ip routing 無し

L2#show ip route
Default gateway is not set

Host               Gateway           Last Use    Total Uses  Interface
ICMP redirect cache is empty
L2#


ip routing 有

L2#show ip route
Codes: 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, E - EGP
       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

Gateway of last reso
*Mar  1 0:47:53.141: %SYS-5-CONFIG_I: Configured from console by consolert is not set

     172.1.0.0/24 is subnetted, 1 subnets
C       172.1.1.0 is directly connected, Vlan1
L2#


ルーテッドポートについて

・サブインターフェースを切れない
・イーサチャネルではこれを使う
・no switchport の設定が要る


Cisco音声VLANについて

Cisco IP Phone のボイス向けVLANと IP Phone経由のPC向けVLANとを、アクセスポートで混在させる機能、とのこと。CDPを使う。PCはネイティブVLANで、IP Phoneは音声VLAN、とのこと。マジか!?

interface FastEthernet0/5
 switchport access vlan 88
 switchport mode access
 switchport voice vlan 101
 spanning-tree portfast
!
interface FastEthernet0/6
 switchport access vlan 88
 switchport mode access
 switchport voice vlan 101
 spanning-tree portfast

spanning-tree portfastは、この機材ではでふぉで入るようだ。



続いて優先制御も含めた設定。まず、Cisco様 謹製コンフィギュレーションガイドは、2960の日本語版。
http://www.cisco.com/cisco/web/support/JP/docs/SW/LANSWT-Access/CAT2960SWT/CG/005/swqos.html?bid=0900e4b1825295c6

キホンは IETF の Differentiated Services。IPヘッダのTOSフィールド6ビットで定義。

英語の differentiate
http://ejje.weblio.jp/content/differentiate


もっとも、マーキングのやり方はいろいろで

・ISLヘッダ26バイト中最後の1バイトの中のさらにおしり3ビットが
 IEEE 802.1p Class of Service を伝達できるフィールドのようで
 ここでCoS(.1p Class of Service)指定
 
・.1q の Tag Control Information (TCI) 中の前3ビットが
Priority Code Point なのでここでCoS指定
 * .1q の前半分16ビットは Tag Protocol Identifierで後ろ12ビットはVLAN ID
  http://www.itbook.info/network/vlan3.html

・デフォはゼロなIPヘッダのTOSフィールドで
 a. アタマ3ビットで IP precedence  をかます
 b. 6ビットで Diffrentiated Service Code Point (DSCP)をかます


TOSフィールドについては

N-Studyさんのこちらとか。
http://www.n-study.com/network/qos04.htm

ASCIIのこれとか。
http://ascii.jp/elem/000/000/449/449327/index-4.html



3区分4通りがあるそうだが当然ISLは問題外として、どこで誰がマーキングするか次第。マーキングの話はまたコンドとして


L2-QOS(config)#mls qos
L2-QOS(config)#
L2-QOS(config)#
L2-QOS(config)#interface range FastEthernet 0/5 - 6
L2-QOS(config-if-range)#mls ?
  qos  qos command keyword

L2-QOS(config-if-range)#mls qos ?
  cos            cos keyword
  dscp-mutation  dscp-mutation keyword
  trust          trust keyword
  vlan-based     vlan-based keyword

L2-QOS(config-if-range)#mls qos trust ?
  cos            cos keyword
  device         trusted device class
  dscp           dscp keyword
  ip-precedence  ip-precedence keyword
  <cr>

つまるところ設定としては

L2-QOS(config-if-range)#mls qos trust cos

または

L2-QOS(config-if-range)#mls qos trust dscp

と仰っているが、QoSをどこでかけるかにもよるか。



QoSはまだまだ続く。




















2015年11月26日木曜日

VTPまわり

こんな状態からスタート。

L2#show vtp
FastEthernet0/1, changed state to upstatus
VTP Version                     : 2
Configuration Revision          : 3
Maximum VLANs supported locally : 1005
Number of existing VLANs        : 132
VTP Operating Mode              : Server
VTP Domain Name                 :
VTP Pruning Mode                : Disabled
VTP V2 Mode                     : Disabled
VTP Traps Generation            : Disabled
MD5 digest                      : 0x7B 0x3B 0xFD 0x2E 0xE1 0xD6 0x87 0x46
Configuration last modified by 172.1.1.8 at 11-25-15 21:15:30
Local updater ID is 172.1.1.8 on interface Vl1 (lowest numbered VLAN interface found)
L2#8#show vtp counters
VTP statistics:
Summary advertisements received    : 0
Subset advertisements received     : 0
Request advertisements received    : 0
Summary advertisements transmitted : 0
Subset advertisements transmitted  : 0
Request advertisements transmitted : 0
Number of config revision errors   : 0
Number of config digest errors     : 0
Number of V1 summary errors        : 0


VTP pruning statistics:

Trunk            Join Transmitted Join Received    Summary advts received from
                                                   non-pruning-capable device
---------------- ---------------- ---------------- ---------------------------
Fa0/46              0                0                0
Fa0/48              0                0                0

L2#show vtp password
The VTP password is not configured.


L2#(config)#vtp mode ?
  client       Set the device to client mode.
  server       Set the device to server mode.
  transparent  Set the device to transparent mode.

L2(config)#vtp mode trans
L2(config)#vtp mode transparent
Setting device to VTP TRANSPARENT mode.

L2(config)#vtp password vtptest
Setting device VLAN database password to vtptest

L2(config)#no vtp pruning
Cannot modify pruning unless in VTP server mode


と、ここまで。Cisco原理主義でない環境において使う場合の、トランスペアレントモード設定。次からはCisco原理主義な環境においてのシゴト向け。


L2(config)#vtp version いくつ
L2(config)#vtp domain ナニナニ
L2(config)#vtp mode どれどれ
L2(config)#vtp password ほにゃらら

あとは、土着VLANが合致しているか、もしくはtrunkで通っているか。そして、カレントで動的な設定情報にはこれらの設定後の情報は出てこないので、show vtp status で確認。ただし、ルータの場合はrunning-configに出てくるし、そもそもvlan.datを削除しても設定はリセットされないケースもあるようだ。とはいえ、これも古い機材のハナシなので直近はどうだかわからない。
 


テーマは変わって、ルータにサブインターフェースを持たせてVLAN間ルーティングな設定。

Router(config-subif)#ip address 172.31.1.254 255.255.255.0

% Configuring IP routing on a LAN subinterface is only allowed if that
subinterface is already configured as part of an IEEE 802.10, IEEE 802.1Q,
or ISL vLAN.

VLANトランクを前置きせずにいきなり設定すると怒られる。ここでのお作法は

Router-F(config)#interface fastEthernet 0.1
Router-F(config-subif)#encapsulation dot1Q 11
Router-F(config-subif)#ip address 172.31.11.254 255.255.255.0
Router-F(config-subif)#exit
Router-F(config)#
Router-F(config)#interface FastEthernet 0.2
Router-F(config-subif)#encapsulation dot1Q 12
Router-F(config-subif)#ip address 172.31.12.254 255.255.255.0
Router-F(config-subif)#exit
Router-F(config)#
Router-F(config)#interface fastEthernet 0.3
Router-F(config-subif)#encapsulation dot1Q 13
Router-F(config-subif)#ip address 172.31.13.254 255.255.255.0
Router-F(config-subif)#end


次にL2側でこれらのVLANの設定。ここで再びお行儀悪くtrunkポートの設定から、

L2-F(config)#interface FastEthernet 0/44
L2-F(config-if)#switchport mode trunk
L2-F(config-if)#switchport trunk encapsulation dot1q
L2-F(config-if)#switchport trunk allowed vlan 11,12,13
L2-F(config-if)#exit


前後してVLAN個別のポートの設定。

L2-F(config)#interface FastEthernet 0/11
L2-F(config-if)#switchport mode access
L2-F(config-if)#switchport access vlan 11
L2-F(config-if)#exit
L2-F(config)#
L2-F(config)#interface FastEthernet 0/12
L2-F(config-if)#switchport mode access
L2-F(config-if)#switchport access vlan 12
L2-F(config-if)#exit
L2-F(config)#
L2-F(config)#interface FastEthernet 0/13
L2-F(config-if)#switchport mode access
L2-F(config-if)#switchport access vlan 13
L2-F(config-if)#end


しかしこれだけでは、L2のVLAN<--->ルータのサブインターフェース間の通信が通らない。L2側のPCで見ていると、span関連のトラフィックしか入らない。はてさて。


とりあえずルータ側でサブインターフェースをいっそ削除! と粗暴なマネをしたところこのられる。

VLAN_TABLE_CHANGE: "FastEthernet0.1":DE-ENCAP
VLAN-DEENCAP: "FastEthernet0.1":802.1Q Id 11:Sense=FALSE:
VLAN_ENCAP_FIXUP: "FastEthernet0.1":
 ENCAP TYPE : 802.1Q
VLAN_TABLE_CHANGE: "FastEthernet0.2":DE-ENCAP
VLAN-DEENCAP: "FastEthernet0.2":802.1Q Id 12:Sense=FALSE:
VLAN_ENCAP_FIXUP: "FastEthernet0.2":
 ENCAP TYPE : 802.1Q
VLAN_TABLE_CHANGE: "FastEthernet0.3":DE-ENCAP
VLAN-DEENCAP: "FastEthernet0.3":802.1Q Id 13:Sense=FALSE:
VLAN_TABLE_CHANGE: "FastEthernet0":DE-ENCAP
VLAN-DEENCAP: "FastEthernet0":802.1Q Id 1:Sense=FALSE:
VLAN_ENCAP_FIXUP: "FastEthernet0":
 ENCAP TYPE : 802.1Q
VLAN-ENCAP-EVENT: dot1q removed from VLAN flags on FastEthernet0
VLAN-ENCAP-EVENT: Packet sizes reset on FastEthernet0
VLAN_ENCAP_FIXUP: "FastEthernet0.3":
 ENCAP TYPE : 802.1Q


サブインターフェースとencapslationを再設定。


Router-F(config)#interface FastEthernet 0.1
Router-F(config-subif)#encapsulation dot1Q 11
*Nov 25 22:45:34.499: VLAN_TABLE_CHANGE: "FastEthernet0":ENCAP
*Nov 25 22:45:34.499: VLAN-ENCAP: "FastEthernet0":802.1Q Id 1:
*Nov 25 22:45:34.503: VLAN_ENCAP_FIXUP: "FastEthernet0":
*Nov 25 22:45:34.503:   802.1Q Id 1 : Native:TRUE
*Nov 25 22:45:34.503:   ENCAP TYPE : ARPA
*Nov 25 22:45:34.503: VLAN_TABLE_CHANGE: "FastEthernet0.1":ENCAP
*Nov 25 22:45:34.503: VLAN-ENCAP: "FastEthernet0.1":802.1Q Id 11:
*Nov 25 22:45:34.535: VLAN_ENCAP_FIXUP: "FastEthernet0.1":
*Nov 25 22:45:34.535:   802.1Q Id 11 : Native:FALSE
*Nov 25 22:45:34.535:   ENCAP TYPE : ARPA
Router-F(config-subif)#exit
Router-F(config)#
Router-F(config)#interface FastEthernet 0.2
Router-F(config-subif)#encapsulation dot1Q 12
*Nov 25 22:46:44.027: VLAN_TABLE_CHANGE: "FastEthernet0.2":ENCAP
*Nov 25 22:46:44.027: VLAN-ENCAP: "FastEthernet0.2":802.1Q Id 12:
*Nov 25 22:46:44.027: VLAN_ENCAP_FIXUP: "FastEthernet0.2":
*Nov 25 22:46:44.027:   802.1Q Id 12 : Native:FALSE
*Nov 25 22:46:44.027:   ENCAP TYPE : ARPA
Router-F(config-subif)#exit
Router-F(config)#
Router-F(config)#interface FastEthernet 0.3
Router-F(config-subif)#encapsulation dot1Q 13
*Nov 25 22:48:05.663: VLAN_TABLE_CHANGE: "FastEthernet0.3":ENCAP
*Nov 25 22:48:05.663: VLAN-ENCAP: "FastEthernet0.3":802.1Q Id 13:
*Nov 25 22:48:05.663: VLAN_ENCAP_FIXUP: "FastEthernet0.3":
*Nov 25 22:48:05.663:   802.1Q Id 13 : Native:FALSE
*Nov 25 22:48:05.663:   ENCAP TYPE : ARPAd


.1qの設定一発目は fa0 に対してネイティブVLANの設定が走っている。L2側でもネイティブVLANを通さなければならない仕様だろうか。

ここで、LANケーブルの挿し間違いに気づいた。たいへんに間が抜けたことだが、トラブルシューティングの練習にはなった。











ARPあたりとVLANあたり

例によってイージスさんからこのあたり。
http://www.infraexpert.com/study/gateway1.htm
 
・Juniper SRX が ARPに応答しない
・BIG-IP でバーチャルサーバを設定したケースにおいて iRuleが…

iRuleって何夜年。

TELさんのこちら
http://cn.teldevice.co.jp/product/etcdetail/f5_irule_guide
http://cn.teldevice.co.jp/product/etcdetail/f5_irule_guide/page/2

F5のこれ
http://www.f5networks.co.jp/shared/pdf/irule_atoz.pdf

iRuleの氷山の表面のホコリ程度の理解を得たところで、イージスさんの「例えばアウトバウンド通信に対して送信元アドレス変換を行う定義をiRuleで定義した場合は…」

?

アウトバウンドのソースアドレスのアドレス変換後に対してARPリクエスト??? 3minuts のネット君比で100分の1ぐらい今の私はアタマが弱い。SRX同士のルートベースVPN接続のケースに関してはさらに…阿寒湖れは。


次にVLANあたり。

MAC VLAN、サブネットVLAN、柔軟VLAN。.1xでAD連携な時世でなかった当時のお話。AD連携どころか .1xの設定をやったことがない私にはこれでも十分未知だが。

技評さんから

知られざるActive Directory技術の「舞台裏」
第2回 誰も教えてくれないActive DirectoryとLDAPの「本当の関係」[後編]

http://gihyo.jp/admin/serial/01/ad2010/0002


1.qのところで

Tag Protocol Identifier 16ビット

Priority Code Point 3ビット
Canonical Format Indicator 1ビット…イーサは0

VLAN Identifier 12ビットなので4096


うしろの3つを指して Tag Control Information 、識別子16+制御3情報で16、都合32ビット。イーサフレームとして1522バイト。

 
(生まれた)まんまVLANがタグ無で流す情報は。

・ しすこディスカバリーちゃねるもといプロトコル
・ ポート Aggregation プロトコル
・ しすこ VLANトランクプロトコル
・ 同 ダイナミック…

ねいてぃぶVLANだからね。


ポートのモード設定は、選択はいろいろあるがつまるところアクセスとトランクの2つ、トランクはお約束でたぶんこんなかんじ。

interface Gigabit(Fast)Ethernet0/いくつ
 switchport trunk encapsulation dot1q
 switchport trunk allowed vlan 92-94,96,99-136
 switchport mode trunk
 switchport nonegotiate


尚、この例で-136にしている理由は、

%SPANTREE_VLAN_SW-2-MAX_INSTANCE: Platform limit of 128 STP instances exceeded.
 
だから。そして追加の場合は switchport trunk allowed vlan に続いて add で

(config-if)#sw t a v ad 79

除外は remove で

(config-if)#sw t a v r 99

, 区切りでVLANひとつひとつ、- で連続するVLAN IDを変更可。また、except や all の指定もあるとのこと。なるほど使いそうにない。設定後の確認は、show vlan や show vlan brief 以外に、switchportについてこのような。


L2#show interfaces fa 0/48  switchport
Name: Fa0/48
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: trunk
Administrative Trunking Encapsulation: dot1q
Operational Trunking Encapsulation: dot1q
Negotiation of Trunking: Off
Access Mode VLAN: 1 (default)
Trunking Native Mode VLAN: 1 (default)
Administrative Native VLAN tagging: enabled
Voice VLAN: none
Administrative private-vlan host-association: none
Administrative private-vlan mapping: none
Administrative private-vlan trunk native VLAN: none
Administrative private-vlan trunk Native VLAN tagging: enabled
Administrative private-vlan trunk encapsulation: dot1q
Administrative private-vlan trunk normal VLANs: none
Administrative private-vlan trunk private VLANs: none
Operational private-vlan: none
Trunking VLANs Enabled: 77,79,100-136
Pruning VLANs Enabled: 2-1001
Capture Mode Disabled
Capture VLANs Allowed: ALL

Protected: false
Unknown unicast blocked: disabled
Unknown multicast blocked: disabled
Appliance trust: none
L2#

プライベートVLANは全く不勉強で何っだけ? 状態。ざっとながめると、VTPでトランスペアレントなアイソレーテッドな区分にしておく、ということで、アイソレーテッドでない場合はコミュニティと。


 switchportについてこのような確認ができる一方で trunk も。

L2#show interfaces fa 0/48  trunk

Port        Mode         Encapsulation  Status        Native vlan
Fa0/48      on           802.1q         trunking      1

Port      Vlans allowed on trunk
Fa0/48      77,79,100-136

Port        Vlans allowed and active in management domain
Fa0/48      77,79,100-136

Port        Vlans in spanning tree forwarding state and not pruned
Fa0/48      77,79,100-136

L2#


VTPは…Ciscoさまに絶対忠誠を誓って上納金の重荷に耐え続ける分には、まぁ便利なんでしょうけれども。気が乗らないのでこの先はまた明日。



2015年11月25日水曜日

シスコスイッチ 機械操作の基本メモ2


Ternary CAM

ternaryって何やねんですが、Weblioさんではこのように。
http://ejje.weblio.jp/content/ternary

ま、これを言ったら、Content Addressable Memory も 土内屋年ですが。Catalystがそもそもシスコじゃないなんて話は既に何分の1世紀か過去の話です。

さておき、ポートASICがTCAMを内部に持っていて、多機能のようです。 検索はTCAMにのっけて、エントリそのものはSRAMで高速化ちゅーことのようですが、なぜそのような原理が成り立つことやら半導体/ロジックのド素人には見当どころか邪推もできません。

多機能とやらは

・MACアドレステーブル
・マルチキャストテーブル
・たぶんおそらくCEFのAdjacencyテーブル
・FIB/Forwarding Information Base (RFC3222らしい)
・QoS ACL
・セキュリティACL

これらを柔軟に運用できるらしい、という程度の解釈しかしてませんが、これも誤っているかもしれません。

TCAMはさておきCEFについてはこちらなど。
http://gihyo.jp/admin/serial/01/net_prac_tech/0008


Switch Database Management てんぷれーとはまた今度。(のだめ風)


Power Sourcing Equipment ---> Power Device って、うーん。af/at以外にPoE でもCisco 独自モードってうーん*2。VLAN単位に設定するってうーん*3。

#show power inline


LLDPって、Ciscoの世界にたとえるならCDPだったんだナルホド!!! 目から鱗ならぬ目ヤニをぬぐった気分。

Stack関連もまた今度。3750が出てからかれこれ10数年!? 早いなー。


ここで急にIPルーティングに戻って。

ルータ側の初歩はさすがに飛ばすとして、

# route add -net 192.168.193.0/24 gw 172.19.19.2 eth0

# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.193.0   172.19.19.2     255.255.255.0   UG    0      0        0 eth0
192.1.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1002   0        0 eth0
0.0.0.0         192.1.1.100   0.0.0.0         UG    0      0        0 eth0

Staticは追加されたものの、 なぜにリンクローカルアドレス16ビットマスクの1行が!? DHCPサーバ機能関係かとも想像するがちょっとさておき。

Staticで一時しのぎをして定期メンテ後に大騒ぎというドタバタ劇をやらかさないためには UnixPower on Networking さんより
http://www.unix-power.net/linux/route.html

network-scripts以下に
route-インターフェース
なファイルを作成して、そこへ
ネットワーク/プレフィックス via 託す先

という作法。













2015年11月24日火曜日

シスコスイッチ 機械操作の基本メモ1

ここでの基本とは

POST: PortASIC CAM Subsystem Tests : Begin
POST: PortASIC CAM Subsystem Tests : End, Status Passed

POST: PortASIC Port Loopback Tests : Begin
POST: PortASIC Port Loopback Tests : End, Status Passed

の文字を読みましょう、という時点から。基本もスタートライン以前です。


#バージョン情報の参照
モデル名
フィーチャー
OSバージョン
ROMバージョン
起動後の経過時間
ブート時に使用したOSファイル名とOSファイルの所在
CPU+DRAMサイズ
シリアルNo.
VLAN数
インターフェース数
商品品番
Ciscoによるブート時の動作指定値(こんふぃぎゅれーしょんれじすた)

#カレントな設定情報
設定ファイルサイズ
OSバージョン
忘れると致命傷な service password-encryption

#インターフェース
show interfaces status
ip default-gateway いくつ
banner motd しゃープ

デフォルト mdx auto
interface range

cle mac- dyn
を投げてもさっぱり消えないmacがあるので何かと思ったら Windows PCが Simple Service Discovery Protocol をまき散らしていた。マルチキャストの 239.255.255.250。ncpa.cpl な設定の中には、SSDPを除外できそうな項目が無い。そこでアヤシそうなプログラムをひとつアンインストールしてみたら、それはSSDPとは無関係で、しかもWiresharkのデータ解析に使う(Wiresharkそのものではない)ツールだった。無知は愚か、知らないのにやらかすのはよりいっそう愚かだ。

さておき clear mac-address-table の続き。

L2(config)#mac address-table static  macm.acma.cmac vlan 1 interface FastEthernet ?
  <0-0>  FastEthernet interface number


16ビットどっと区切りのVLAN-INTの書式。永続的にキャッシュなんてよっぽど特殊なケースでしかやらんと思うがこれも私が無知なだけの可能性は大。

また、無知誤用な私にはニーズが見えないagingタイム変更。存在しないVLANに対しても設定は入るようだが、試しているのは昔の機器なので今はどうか知らない。

L2(config)#mac address-table aging-time 299 vlan 2


ポートセキュリティは

手動式
制限付き自動式
べとべと式

の3つ。うしろ2つの違いは、copy run starで再起動後に持ち越せるかどうか、と、エージングタイムが無期限になるかどうか。如何せん無知で思考が硬直なので、これらの活用シーンの想像に苦しむ。

無期限の場合はともかくとして、エージングタイムは0-1440分。

それから、上限数はVEN毎のVLAN毎に決まっているらしいがそもそも、VEMって何だ!? な低次元でどうやら

Virtual Ethernet Modul

であるようだ。Nexus系では Virtual Supervisor Module という概念もある。詳しくはしすこ本家のコレで。
http://www.cisco.com/cisco/web/support/JP/docs/SW/DCSWT/Nex1000VSWT/CG/030/b_Cisco_Nexus_1000V_Security_Configuration_Guide_2_1_1_chapter_01011.html?bid=0900e4b182eb8de0

デバイスあたりの上限は8192で、インターフェース毎のでふぉると最大数は1、VLANあたりはでふぉるとの最大数が無いとのこと。VLANの最大数設定はトランクでないと無意味ともある。

まだ、利用シーンが見えない超低次元。あるいは、コルセンのような端末がガッチリ決まっている場所なら有用であるだろうか。


違背冒涜モード(ヴぁいおれーしょんモード)においては


防護
制限
閉鎖

の3つ。前の2つの違いはSNMPトラップ/syslogがあるかどうか、後ろの2つの違いは、ポートを閉める(errdisable)かどうか。


次に、設定のシゴトについて。

L2(config-if)#switchport port-security ?
  aging        Port-security aging commands
  mac-address  Secure mac address
  maximum      Max secure addresses
  violation    Security violation mode
  <cr>

L2(config-if)#switchport port-security
Command rejected: FastEthernet0/3 is a dynamic port.
L2(config-if)#

どうも私が、概念自体ろくにわかっていないか、とてつもなく浅はかであるようで。


(config-if)#switchport port-security mac-address ?
  H.H.H   48 bit mac address
  sticky  Configure dynamic secure addresses as sticky

でふぉは制限付き自動式、このでふぉは、switchport access を設定した後のでふぉ!? ということかもしれない。これを確認するには、アクセスポートの下にリピータHUBをぶら下げて端末2台つないでみればいいか。ああ面倒くさい。
 
と、ここで。端末1台としてCentOS機のほうをリピータHUBにぶら下げてみたのだが、ブートが遅い遅い。

さておき、 端末2台をぶら下げてみたが、2台ともL2越しのでふぉげルータにpingが通る。ダイナミックでインターフェース毎最大がデフォ1ならが1台しかつながらない状況でありそうなものだがそうではない。しかしここで、

switchport mode access

の入力をしていないことに気づいて試したところ

L2(config-if)#switchport mode access
Nov 24 17:39:22.707: PSECURE: psecure_port_dtp_modechange invoked

 invoke the protection of…

で何やら切願されてしまったようだ。また、この状態でpingは2台とも通ったままだ。

L2#show port-security
Secure Port  MaxSecureAddr  CurrentAddr  SecurityViolation  Security Action
                (Count)       (Count)          (Count)
---------------------------------------------------------------------------
---------------------------------------------------------------------------
Total Addresses in System (excluding one mac per port)     : 0
Max Addresses limit in System (excluding one mac per port) : 6272

何も検出していない。当該ポートにポートセキュリティの最大数をあらためて設定してみても、

L2(config-if)#switchport port-security maximum 1
L2(config-if)#end
L2#
Nov 24 17:49:53.466: PSECURE: Max addresses per port = 6272
Nov 24 17:49:53.466: PSECURE: Max addresses per port = 6272

 ポート毎の最大は6272ですよというログが。デフォが1でなければ、最大数1の設定もできない?? そんなわけもないのでこちらさま。

Office N-Studyhttp://www.n-study.com/network/2011/10/post_127.html

「restrictのモードは、イーサネットフレームを破棄して、セキュリティ違反があったことをログに残します。」

先の時点ではヴぁいおれーしょんを設定していなかったので、

L2(config-if)#switchport port-security violation restrict

追加。すると


PSECURE: Initializing port-secure sub block
PSECURE: Violation mode is: 1
%SYS-5-CONFIG_I: Configured from console by console
PSECURE: psecure_get_next_mac_from_hat: returning NULL on Fa0/3

from_hatがわからないが、エラーはあがるもののPC2台のPingは落ちない、という状況。

あるいは、時系列的に設定変更以前からのトラフィックだから? んなわけがあるかと思って両PCのLANケーブルを一時抜いてみたが、再び挿すと2台ともPingが通る。また、この際にL2において

#show debug
Port Security:
  All Port Security debugging is on

であるにも関わらず、何らログメッセージが生じない。設定が無効としか思えないが、先のログのように一部の PSECURE: はあがってくる。無効ではない、不完全だということか。ここで

switchport port-security

を再度設定すると、2台のうち1台が Destination Host Unreachableとなった。つまり、

switchport access # vlanは指定しない
switchport port-security

を設定した後、violationを設定して相応の結果になる、ということのようだ。また、この時点においてlog上では


PSECURE: swidb = FastEthernet0/3 mac_addr = PC2のMACアドレス vlanid = 1
PSECURE: Adding 0023.8ba0.35a7 as dynamic on port Fa0/3 for vlan 1
PSECURE: Violation/duplicate detected upon receiving PC2のMACアドレス on vlan 1: port_num_addrs 1 port_max_addrs 1 vlan_addr_ct 1: vlan_addr_max 65535 total_addrs 0: max_total_addrs 6272
PSECURE: Security violation, TrapCount:68
PSECURE: Read:69, Write:70

 延々とこれを吐きまくる。debugを止めていないのか? と思ったが、show debugには何もなく、restrict を protect に変更しても吐き続ける。それどこか、ポートセキュリティによって拒否されたPC2のLANケーブルを切り離してもまだ。

当然、この時点では mac-address-tableにはのってない。それでも、

%PORT_SECURITY-2-PSECURE_VIOLATION: Security violation occurred, caused by MAC address PC2のMACアドレス on port FastEthernet0/3.

をおよそ6秒毎に、えんえんと吐き続ける。あるいは、arpテーブルが消えるまで待ってみるか。といっても、

ARP type: ARPA, ARP Timeout 04:00:00

なので、本当に待っているわけにはいかない。これはあらためて。


それから、いーじすさんの設定例中には

L2(config-if) # switchport port-security aging time 30
L2(config-if) # switchport port-security aging type inactivity

inactivity は an inactive volcano や an inactive member というように使われるようで、ここでは不活性後30分、ということかと。おそらくたぶん。



























2015年11月23日月曜日

BINDの設定でエラーの嵐

これまでのところ、コピペ君がイミフ状態、で反面教師にさえも全くならないので詳細は割愛。


2015年11月21日土曜日

sendmailでやらかして溜めた未送信メールを削除

頼らせていただいたのはこちらさま。

sendmailのメールキューを確認、削除する方法
http://jehupc.exblog.jp/19944459/


mailq
can not chdir(/var/spool/mqueue/): Permission denied
Program mode requires special privileges, e.g., root or TrustedUser.

なのでrootで実施。

ls /var/spool/mqueue

rm -f /var/spool/mqueue/*

で抹消。ついでにログも/var/log/maillogを開いて削除。

それから、この環境においては、未送信で蓄積されたメールは1時間毎にリトライされていた。なるほどそういうものか。









sendmail の一歩目の足を着けず とりあえずaliasの設定が間違っていた

まにゅある通りに設定してぜんぶうまくいって当然そうでなかったら困る、な奴隷要員を目指してはいないので、トラブルそのものは何ら苦痛でないのだが。


これが、ジブンがどこで設定を誤っているか、設定以前に何の認識がおかしいのか、あるいは入力を誤っているか…という側面では、苦痛はいんくりーす すりーふぉうるどです。


ともあれ。


今日のせんどめいる様。


 CentOSのブートにえらい時間がかかると思えば、どうもsendmailの立ち上げにえらい時間を要しているらしい。sendmail本体のみならずsm-clientもおそらく。

というのも、昨日は Listen だったポートが今日は見当たらず、

/etc/rc.d/init.d/sendmail restart

においても時間を要したことからだが。邪推極まりないのは言わずもがな。とりあえず

dmseg | less

で何かわかるようなジブンではない。もちろんsyslogやjounalがどうこうは あばうと ふぉあはんどれっど らいと-いやあず あうぇい ふろむ みー。


CentOS 7のログ管理「journald」
https://thinkit.co.jp/story/2014/12/18/5389


こうなると、なうあいしー いんなでぃふぁれんとうえい、素人は素人なりに取り組まなくてはならないわけですが。そもそも、昨日と今日の差異は何か!? 昨日の めにあざーず 後に、何を変更したか? sendmail.mcに手を加えたか?

変更してない、いや、何も変更していないわけがない。差異は設定ファイルではなくて、CentOS機がつながっているテストルータ。これを今日は起動させてない。そこでルータを起動させて再び

/etc/rc.c/init.d/sendmail

Shutting down sm-client: FAILED
Shutting down sendmail: FAILED
Starting sendmail: OK
Starting sc-client: OK


Startingはsendmail sm-clientどちらも時間は要したが結果はOK。しかしsmtpのポートはListenとならない。そもそもループバック、LANいずれのサービスもあがってこない。rebootしてもNG。昨日はreboot後にさらにサービスを下げ上げしているのでここでまたしても

/etc/rc.d/init.d/sendmail restart

Shutting down sm-client: OK
Shutting down sendmail:OK
Starting sendmail: OK
Starting sc-client: OK


機能が万事動作しているかどうかはともかく、boot時に乗ってはいたようだ。netstatにはあらわれないが。念のためループバックとLAN側にpingしてみたがアドレスそのものは生きている。

次に、sendmail.mc 内でアドレス指定なしのMTAをMSPに変更しさらにrebootしてみた。結果、maillogに次の内容が、


sendmail[3000]: starting daemon (8.14.4): SMTP+queueing@01:00:00
sendmail[3000]: NOQUEUE: SYSERR(root): opendaemonsocket: daemon MSP: cannot listen: Address already in use
sendmail[3000]: daemon MSP: problem creating SMTP socket

それから、以前イミもわからず設定しかけた、外部メール向けの転送設定の残骸エラーも。全容はこちら

sendmail[3000]: starting daemon (8.14.4): SMTP+queueing@01:00:00
sendmail[3000]: NOQUEUE: SYSERR(root): opendaemonsocket: daemon MSP: cannot listen: Address already in use
sendmail[3000]: daemon MSP: problem creating SMTP socket

sm-msp-queue[3009]: starting daemon (8.14.4): queueing@01:00:00

sendmail[3000]: NOQUEUE: SYSERR(root): opendaemonsocket: daemon MSP: cannot bind: Address already in use
sendmail[3000]: daemon MSP: problem creating SMTP socket

sendmail[3001]: tAL0o2Sk002546: to=hogehoge@gmail.com, delay=02:01:07, xdelay=00:00:10, mailer=esmtp, pri=481619, relay=alt4.gmail-smtp-in.l.google.com. [173.194.219.27], dsn=4.0.0, stat=Deferred: alt4.gmail-smtp-in.l.google.com.: No route to host
sendmail[3001]: tAK7LdSw002818: to=hogehoge@gmail.com, ctladdr=<root@centostest> (0/0), delay=19:31:31, xdelay=00:00:00, mailer=esmtp, pri=840416, relay=alt4.gmail-smtp-in.l.google.com., dsn=4.0.0, stat=Deferred: alt4.gmail-smtp-in.l.google.com.: No route to host

sendmail[3000]: NOQUEUE: SYSERR(root): opendaemonsocket: daemon MSP: cannot bind: Address already in use
sendmail[3000]: daemon MSP: problem creating SMTP socket
この後7回繰り返し

sendmail[2619]: starting daemon (8.14.4): SMTP+queueing@01:00:00
sendmail[2619]: NOQUEUE: SYSERR(root): opendaemonsocket: daemon MSP: cannot listen: Address already in use
sendmail[2619]: daemon MSP: problem creating SMTP socket

sm-msp-queue[2628]: starting daemon (8.14.4): queueing@01:00:00

sendmail[2619]: NOQUEUE: SYSERR(root): opendaemonsocket: daemon MSP: cannot bind: Address already in use
sendmail[2619]: daemon MSP: problem creating SMTP socket
もう2回

sendmail[2620]: tAL0o2Sk002546: to=hogehoge@gmail.com, delay=02:03:16, xdelay=00:00:14, mailer=esmtp, pri=571619, relay=alt4.gmail-smtp-in.l.google.com. [173.194.219.27], dsn=4.0.0, stat=Deferred: alt4.gmail-smtp-in.l.google.com.: No route to host
sendmail[2620]: tAK7LdSw002818: to=hogehoge@gmail.com, ctladdr=<root@centostest> (0/0), delay=19:33:40, xdelay=00:00:00, mailer=esmtp, pri=930416, relay=alt4.gmail-smtp-in.l.google.com., dsn=4.0.0, stat=Deferred: alt4.gmail-smtp-in.l.google.com.: No route to host

sendmail[2619]: NOQUEUE: SYSERR(root): opendaemonsocket: daemon MSP: cannot bind: Address already in use
sendmail[2619]: daemon MSP: problem creating SMTP socket
もう2回

sendmail[2889]: NOQUEUE: SYSERR(root): opendaemonsocket: daemon MTA: server SMTP socket wedged: exiting

sm-msp-queue[2900]: starting daemon (8.14.4): queueing@01:00:00
sm-msp-queue[2901]: tAL0p27h002557: to=testuser1, delay=01:53:19, xdelay=00:00:00, mailer=relay, pri=391434, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]
sm-msp-queue[2901]: tAL0p27l002557: to=testuser1, delay=01:53:17, xdelay=00:00:00, mailer=relay, pri=391435, relay=[127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]

sm-msp-queue[2901]: tAL0p27g002557: to=root, delay=01:53:20, xdelay=00:00:00, mailer=relay, pri=391445, relay=[127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]
sm-msp-queue[2901]: tAL0p27i002557: to=root, delay=01:53:19, xdelay=00:00:00, mailer=relay, pri=391449, relay=[127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]
sm-msp-queue[2901]: tAL0p27j002557: to=root, delay=01:53:18, xdelay=00:00:00, mailer=relay, pri=391449, relay=[127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]
sm-msp-queue[2901]: tAL0p27k002557: to=root, delay=01:53:19, xdelay=00:00:00, mailer=relay, pri=391467, relay=[127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]

sm-msp-queue[2901]: tAK9gepE002867: to=testuser1, ctladdr=root (0/0), delay=17:01:43, xdelay=00:00:00, mailer=relay, pri=480200, relay=[127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]
sm-msp-queue[2901]: tAK9mdVA002906: to=root, ctladdr=testuser1 (500/500), delay=16:55:44, xdelay=00:00:00, mailer=relay, pri=480212, relay=[127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]
sm-msp-queue[2901]: tAK8iprJ003729: to=root, ctladdr=root (0/0), delay=17:59:32, xdelay=00:00:00, mailer=relay, pri=750204, relay=[127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]
sm-msp-queue[2901]: tAK8q97T003753: to=testuser1, ctladdr=root (0/0), delay=17:52:14, xdelay=00:00:00, mailer=relay, pri=750204, relay=[127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]
sm-msp-queue[2901]: tAK8T8jg003365: to=testuser1, ctladdr=root (0/0), delay=18:15:15, xdelay=00:00:00, mailer=relay, pri=840222, relay=[127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]
sm-msp-queue[2901]: tAK7jH1h003147: to=testuser1, ctladdr=testuser1 (500/500), delay=18:59:06, xdelay=00:00:00, mailer=relay, pri=930213, relay=[127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]
送信IDのようなもの?が微妙に変わりつつつまるところ、こねくしょんりふゅーずどばい、なオチ。


sendmail[3000]: starting daemon (8.14.4): SMTP+queueing@01:00:00
sendmail[3000]: NOQUEUE: SYSERR(root): opendaemonsocket: daemon MSP: cannot listen: Address already in use
sendmail[3000]: daemon MSP: problem creating SMTP socket

sm-msp-queue[3009]: starting daemon (8.14.4): queueing@01:00:00
sendmail[3000]: NOQUEUE: SYSERR(root): opendaemonsocket: daemon MSP: cannot bind: Address already in use
sendmail[3000]: daemon MSP: problem creating SMTP socket

sendmail[3001]: tAL0o2Sk002546: to=hogehoge@gmail.com, delay=02:01:07, xdelay=00:00:10, mailer=esmtp, pri=481619, relay=alt4.gmail-smtp-in.l.google.com. [173.194.219.27], dsn=4.0.0, stat=Deferred: alt4.gmail-smtp-in.l.google.com.: No route to host
sendmail[3001]: tAK7LdSw002818: to=hogehoge@gmail.com, ctladdr=<root@centostest> (0/0), delay=19:31:31, xdelay=00:00:00, mailer=esmtp, pri=840416, relay=alt4.gmail-smtp-in.l.google.com., dsn=4.0.0, stat=Deferred: alt4.gmail-smtp-in.l.google.com.: No route to host

sendmail[3000]: NOQUEUE: SYSERR(root): opendaemonsocket: daemon MSP: cannot bind: Address already in use
sendmail[3000]: daemon MSP: problem creating SMTP socket
このあと6回

sendmail[2619]: starting daemon (8.14.4): SMTP+queueing@01:00:00
sendmail[2619]: NOQUEUE: SYSERR(root): opendaemonsocket: daemon MSP: cannot listen: Address already in use
sendmail[2619]: daemon MSP: problem creating SMTP socket

sm-msp-queue[2628]: starting daemon (8.14.4): queueing@01:00:00

sendmail[2619]: NOQUEUE: SYSERR(root): opendaemonsocket: daemon MSP: cannot bind: Address already in use
sendmail[2619]: daemon MSP: problem creating SMTP socket
もう1回

sendmail[2620]: tAL0o2Sk002546: to=hogehoge@gmail.com, delay=02:03:16, xdelay=00:00:14, mailer=esmtp, pri=571619, relay=alt4.gmail-smtp-in.l.google.com. [173.194.219.27], dsn=4.0.0, stat=Deferred: alt4.gmail-smtp-in.l.google.com.: No route to host
sendmail[2620]: tAK7LdSw002818: to=hogehoge@gmail.com, ctladdr=<root@centostest> (0/0), delay=19:33:40, xdelay=00:00:00, mailer=esmtp, pri=930416, relay=alt4.gmail-smtp-in.l.google.com., dsn=4.0.0, stat=Deferred: alt4.gmail-smtp-in.l.google.com.: No route to host

sendmail[2619]: NOQUEUE: SYSERR(root): opendaemonsocket: daemon MSP: cannot bind: Address already in use
sendmail[2619]: daemon MSP: problem creating SMTP socket
このあと5回


つまるところ、

・MSPデーモンは、SMTPソケットをつくる上での問題に出くわしました。
・外部メール転送(の設定の残骸)は No route to host です。
・内部のユーザ間のメールを送ろうとおもったけどループバックでこねくしょんりふゅーずどばい、ですよと。

そこで、MTAは外部向けというかLAN側IPアドレス、MSPをループバックにしてみたら。

内部メールは Message accepted for delivery
外部転送メール(の設定の残骸)は No route to host

というようにログ出力が変わった。しかし、rootやテストユーザでは、依然として

No mail for ユーザ

なのだが。なんという ぱてぃえんす ならぬ patience。


で、結局のところ。



内部の問題はaliasの設定が間違っていたと。



こんな素人未満なネタでなく、まっとな方々のやりとりはこちら。

http://centossrv.com/bbshtml/webpatio/1919.shtml



2015年11月20日金曜日

sendmailの基礎を学ばせていただいている途も駆け出しの半歩目


レンタルサーバー・自宅サーバー設定・構築のヒント さんから
 sendmail設定(1)必要最小限の設定で使ってみる
 http://server-setting.info/centos/sendmail_1_simple_setting.html

先はまだまだ遠い。というのも、そもそもgmail連携どうこう以前に、ローカルでアカウント間のメールもままならないからだ。No mail for (ゆーざ) な状態。rootで

tail -f /var/spool/mail/ゆーざ

を表示したところ、

stat=Deferred: Connection refused by [127.0.0.1]

とのこと。

netstat -at

で見るとSMTPがそもそも開いてない。

cat /etc/mail/sendmail.mc

を確認してみたが

DAEMON_OPTIONS(`Port=smtp, Name=MTA')dnl

の記述はある。あるだけでいいのかどうかはわからないが、この1行だけの問題ではなさそう。とりあえず、私がイミもわからずgmail連携で突っ込んだ設定をコメントアウト

dnl ## define(`confAUTH_OPTIONS',`A')dnl
dnl ## define(`confAUTH_MECHANISMS' `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
dnl ## TRUST_AUTH_MECH(`EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
dnl ## FEATURE(`authinfo', `Hash -o /etc/mail/authinfo')dnl
dnl ## define(`SMART_HOST', `smtp.gmail.com')dnl
dnl ## define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
dnl ## define(`ESMTP_MAILER_ARGS', `TCP $h 587')dnl

そして、そもそもgmail連携のために変更したはずの次の2行が、変更されていないこと判明。

dnl TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
dnl define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl

まさに誤用blog。orz


これでいちおうもとに戻したはずなので、

m4 /usr/share/sendmail-cf/m4/cf.m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

これで設定ファイルの書き換えがなされた、はず、かもしれない、、、



で、sendmailの再起動

/etc/rc.d/init.d/sendmail restart

ところが

Shutting down sm-client: FAILED
Shutting down sendmail: FAILED
Starting sendmail: OK
Starting sm-client: OK

シャットダウンに失敗したのか、そもそもちゃんと動いてないのか。。。


ここであらためてテストメールを送信してみるも、

stat=Deferred: Connection refused by [127.0.0.1]

ループバックから怒られる。

netstat -at

で見るとやはりsmtpが開いてない。さて、、少々シンドくなりつつ探して見つかったのはこちら様。


daro's technical blog
http://www.dolejarz.com/sendmail-deferred-connection-refused-127-0-0-1/

書式はちょっと違うが、NICのIPアドレスを設定…というような話にも読めるが、まず、MSPがわからない。これはどうも Mail Submission Program であるようだ。ここでの問題はたった1台の内部のことなので、問題のひとつ外のことであるようにも思えるが。

とりあえず、NICのIPアドレスを一応設定はしてみた。ループバックと関係があるのか!?

/etc/mail/sendmail.mc

を書き換えた後に

m4 /usr/share/sendmail-cf/m4/cf.m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

で、sendmailの再起動

/etc/rc.d/init.d/sendmail restart

やはり、sendmail本体のシャットダウンに失敗する。とりあえずStartingはOKなのでポートを見てみると

smtpがlistenになっていない。ここでOSごと再起動するとあら不思議!

172.x.x.x:smtp *.* Listen
localhost:smtp *.* Listen

しかしこれに続いて

localhost:smtp localhost:39966 ESTABLISHED
localhost:39966 localhost:smtp ESTABLISHED


ここで、Linuxにおける…というより一般論のメールシステムのおさらい。


Linuxexpert さんから
http://linuxexpert.ne.jp/modules/pukiwiki/46.html


さておき、ここで再びメールのログを見てみると。

cat /var/log/maillog

いつの間にか、数日前からの膨大なログが。。


つづく、、


















2015年11月19日木曜日

CentOS IPv6 のdhcpd.confサンプルから学ぶ いや、学べる前提な素養が自分にあるか?

6.7の
/usr/share/doc/dhcp*/dhcpd6.conf.sample
中の記載。


マッタク未知の世界で、ゼロどころかマイナスから紐解き中。


# Server configuration file example for DHCPv6
# From the file used for TAHI tests.

# IPv6 address valid lifetime
#  (at the end the address is no longer usable by the client)
#  (set to 30 days, the usual IPv6 default)
default-lease-time 2592000;

# IPv6 address preferred lifetime
#  (at the end the address is deprecated, i.e., the client should use
#   other addresses for new connections)
#  (set to 7 days, the  usual IPv6 default)
preferred-lifetime 604800;

# T1, the delay before Renew
#  (default is 1/2 preferred lifetime)
#  (set to 1 hour)
option dhcp-renewal-time 3600;

# T2, the delay before Rebind (if Renews failed)
#  (default is 3/4 preferred lifetime)
#  (set to 2 hours)
option dhcp-rebinding-time 7200;

# Enable RFC 5007 support (same than for DHCPv4)
allow leasequery;


# リースクエリそのものを全く理解していないので後日こちらさまなど。

# http://netbuffalo.doorblog.jp/archives/4284824.html

# Global definitions for name server address(es) and domain search list
option dhcp6.name-servers 3ffe:501:ffff:100:200:ff:fe00:3f3e;
option dhcp6.domain-search "test.example.com","example.com";

# Set preference to 255 (maximum) in order to avoid waiting for
# additional servers when there is only one
##option dhcp6.preference 255;

# Server side command to enable rapid-commit (2 packet exchange)
##option dhcp6.rapid-commit;

# The delay before information-request refresh
#  (minimum is 10 minutes, maximum one day, default is to not refresh)
#  (set to 6 hours)
option dhcp6.info-refresh-time 21600;

# The path of the lease file
dhcpv6-lease-file-name "/usr/local/var/db/dhcpd6.leases";

# Static definition (must be global)
host myclient {
        # The entry is looked up by this
        host-identifier option
                dhcp6.client-id 00:01:00:01:00:04:93:e0:00:00:00:00:a2:a2;

        # A fixed address
        fixed-address6 3ffe:501:ffff:100::1234;

        # A fixed prefix
        fixed-prefix6 3ffe:501:ffff:101::/64;

        # Override of the global definitions,
        # works only when a resource (address or prefix) is assigned
        option dhcp6.name-servers 3ffe:501:ffff:100:200:ff:fe00:4f4e;

        # For debug (to see when the entry statements are executed)
        #  (log "sol" when a matching Solicitation is received)
        ##if packet(0,1) = 1 { log(debug,"sol"); }
}

host otherclient {
        # This host entry is hopefully matched if the client supplies a DUID-LL
        # or DUID-LLT containing this MAC address.
        hardware ethernet 01:00:80:a2:55:67;

        fixed-address6 3ffe:501:ffff:100::4321;
}

# The subnet where the server is attached
#  (i.e., the server has an address in this subnet)
subnet6 3ffe:501:ffff:100::/64 {
        # Two addresses available to clients
        #  (the third client should get NoAddrsAvail)
        range6 3ffe:501:ffff:100::10 3ffe:501:ffff:100::11;

        # Use the whole /64 prefix for temporary addresses
        #  (i.e., direct application of RFC 4941)
        range6 3ffe:501:ffff:100:: temporary;

        # Some /64 prefixes available for Prefix Delegation (RFC 3633)
        prefix6 3ffe:501:ffff:100:: 3ffe:501:ffff:111:: /64;
}

# A second subnet behind a relay agent
subnet6 3ffe:501:ffff:101::/64 {
        range6 3ffe:501:ffff:101::10 3ffe:501:ffff:101::11;

        # Override of the global definitions,
        # works only when a resource (address or prefix) is assigned
        option dhcp6.name-servers 3ffe:501:ffff:101:200:ff:fe00:3f3e;

}

# A third subnet behind a relay agent chain
subnet6 3ffe:501:ffff:102::/64 {
        range6 3ffe:501:ffff:102::10 3ffe:501:ffff:102::11;
}



そもそDHCPv6の基本的なメッセージの種類は。
https://ja.wikipedia.org/wiki/DHCPv6

Solicit, 1
Advertise, 2
Request, 3
Confirm, 4
Renew, 5
Rebind, 6
Reply, 7
Release, 8
Decline, 9
Reconfigure, 10
Information request, 11
Relay-forward, 12
Relay-reply, 13



CCNA Aegis さん拝読メモ DNSのあたりから

DNSの前にDHCPの試験対策、Discover-->Offer-->Request--->Ackでクライアント側68のサーバ側67。

フリィくぉりふぁいどドメインネームは、ルートトップセカンドサード…。

ゾーン転送は、セキュリティ上の観点からそのドメイン内のセカンダリDNSサーバ以外と行わないのが基本。


Uniform Resource Identifier (URI) Schemes
http://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml


HTTP
リクエストとレスポンス
リクエスト行とステータス行
ステータスコードはまた今度。(のだめ)

HELO
250
MAIL FROM
250
RCPT TO
250
DATA
354
Hon-Bun
250
QUIT
221

USER
+OK/-ERR
RASS
+OK/-ERR
STAT
+OK メール数とメールサイズ/-ERR
LIST
+OK 1 いくつ 2 いくついくつ (octets)/-ERR
RETR 1
OK どんだけ/-ERR
DELE 1
+OK/-ERR
QUIT
+OK/-ERR


Outbound Port 25 Blocking と弊害(個人的にもビジホで/Webメールで代用できたが)





イーサタイプ

イーサタイプ


0x0800     IPv4
0x0806     ARP
0x8100     IEEE802.1q
0x86dd     IPv6

 binary digits で書き直すと

0000 1000 0000 0000 IPv4
0000 1000 0000 0110 ARP
1000 0001 0000 0000 .1q
1000 0110 1101 1101 IPv6




2015年11月18日水曜日

DHCPサーバ機能をルータから CentOSへ移行

まず、Ciscoルータに任せたDCHP機能を削除。

no ip dhcp pool DHCP-PoolAddresses

これで

 network
 default-router
 dns-server
 domain-name
 netbios-node-type
 lease

がごっそり消えるが、

ip dhcp excluded-address いくつ
ip dhcp excluded-address いくついくつ

は残っているので、個別に消す。次に、転送先のDHCPサーバのIPアドレスを
、DHCPクライアントがつながるインターフェースで設定。


Router(config-if)#ip helper-address ほげほげ


これだけだと、UDPブロードキャストが全部転送されるので、次の範囲から適宜除外


Router(config)#no ip forward-protocol udp ?
  <0-65535>      Port number
  biff           Biff (mail notification, comsat, 512)
  bootpc         Bootstrap Protocol (BOOTP) client (68)
  bootps         Bootstrap Protocol (BOOTP) server (67)
  discard        Discard (9)
  dnsix          DNSIX security protocol auditing (195)
  domain         Domain Name Service (DNS, 53)
  echo           Echo (7)
  isakmp         Internet Security Association and Key Management Protocol
                 (500)
  mobile-ip      Mobile IP registration (434)
  nameserver     IEN116 name service (obsolete, 42)
  netbios-dgm    NetBios datagram service (138)
  netbios-ns     NetBios name service (137)
  netbios-ss     NetBios session service (139)
  non500-isakmp  Internet Security Association and Key Management Protocol
                 (4500)
  ntp            Network Time Protocol (123)
  pim-auto-rp    PIM Auto-RP (496)
  rip            Routing Information Protocol (router, in.routed, 520)
  snmp           Simple Network Management Protocol (161)
  snmptrap       SNMP Traps (162)
  sunrpc         Sun Remote Procedure Call (111)
  syslog         System Logger (514)
  tacacs         TAC Access Control System (49)
  talk           Talk (517)
  tftp           Trivial File Transfer Protocol (69)
  time           Time (37)
  who            Who service (rwho, 513)
  xdmcp          X Display Manager Control Protocol (177)
  <cr>

詳しいことは、ネットワークエンジニアとして さんのこちらで。
http://www.infraexpert.com/study/dhcp3.htm


個人的には、次を止めてみた。

ip forward-protocol nd
no ip forward-protocol udp tftp
no ip forward-protocol udp nameserver
no ip forward-protocol udp domain
no ip forward-protocol udp time
no ip forward-protocol udp netbios-ns
no ip forward-protocol udp netbios-dgm

1行目は入力していないが。ポート番号でなら、37,42,53,69,137,138。

また、ここで動作確認をしたところ、WindowsのDHCPクライアントで /renew が通らなかった。これは直前のエントリにも書いたが、Windows ではDHCPサーバアドレスを保持し続けるようだ。私が試した限りインターフェースを無効化/有効化だけではリセットされなかった。その後OSを再起動してしまったが、少なくともDHCPクライアントの機能の停止と再開は必要そうだ。



追記:

ルータの設定オプションに表示される項目をぜんぶ入れてみたところ

no ip forward-protocol udp biff
no ip forward-protocol udp discard
no ip forward-protocol udp dnsix
no ip forward-protocol udp domain
no ip forward-protocol udp echo
no ip forward-protocol udp isakmp
no ip forward-protocol udp mobile-ip
no ip forward-protocol udp nameserver
no ip forward-protocol udp netbios-dgm
no ip forward-protocol udp netbios-ns
no ip forward-protocol udp netbios-ss
no ip forward-protocol udp non500-isakmp
no ip forward-protocol udp ntp
no ip forward-protocol udp pim-auto-rp
no ip forward-protocol udp rip
no ip forward-protocol udp snmp
no ip forward-protocol udp snmptrap
no ip forward-protocol udp sunrpc
no ip forward-protocol udp syslog
no ip forward-protocol udp tacacs
no ip forward-protocol udp talk
no ip forward-protocol udp tftp
no ip forward-protocol udp time
no ip forward-protocol udp who
no ip forward-protocol udp xdmcp


UDP port (ポート番号) not found to delete

というメッセージが表示され、一部は反映されなかった。背景をまったくわかっちゃいないがメモ。


それから、DHCPクライアントとは別ネットワークに移動したCentOSのDHCPサーバーだが、移動先のサブネットについてdhcpd.confへ追記が必要だった。
 
[manager@centosserver ~]# cat /etc/dhcp/dhcpd.conf
#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.sample
#   see 'man 5 dhcpd.conf'
#
option domain-name "centosserver.local";

option domain-name-servers (実際のISPのDNSサーバIPアドレス);

default-lease-time 60;

max-lease-time 180;

authoritative;

subnet 172.1.0.0 netmask 255.255.255.0 {
        range dynamic-bootp 172.1.0.1 172.1.0.61;
        option broadcast-address 172.1.0.255;
        option routers 172.1.0.254;
}


subnet 172.1.1.0 netmask 255.255.255.0 {
        range dynamic-bootp 172.1.1.65 172.1.1.125;
        option broadcast-address 172.1.1.255;
        option routers 172.1.1.254;
}













また、どういうわけかインターフェースの指定も消えていた。

[manager@centosserver ~]# cat /etc/sysconfig/dhcpd
# Command line options here
DHCPDARGS=eth0