SRX100なれはじめ その3(基本的なルーター構築)
今回から、簡単なルーターの構築をしていこうと思います。 デフォルトに近い構成なので、半分デフォルトconfigの解説になりそうですがあしからず。
構成
- IPアドレスは右記、Trust(fe0/0/0): 192.168.1.1/24, Untrust(fe0/0/1-7): 192.168.0.101/24
- 上流のゲートウェイは192.168.0.1
- 上流には、192.168.1.0のゲートウェイが192.168.0.101であることは設定済みとする
- 定義するゾーンは標準のTrust, Untrustのみ
- Trust → Untrustへの通信はすべてaccept
- Untrust → Trustの通信はすべてDiscard(deny)
余計な初期configの削除
SSGもですが、Juniperの機器は初期でIPアドレス等が設定されています。 途中から設定するとつまづきやすいので一度削除してしまいましょう
[edit] #初期のDNSサーバー設定削除 root# delete system name-server #初期のインタフェース設定/VLAN削除 root# delete interfaces root# delete vlans vlan-trust #機器のサービス(管理画面など)の設定削除 root# delete system services
インタフェースへのアドレス設定
[edit] root# set interfaces fe-0/0/0 unit 0 family inet address 192.168.1.101/24
Trust側の設定(VLANの設定)
- 新規VLANを作成(vlan-trust)
#VLAN10のvlan-trustという名前のvlanを作成 root# set vlans vlan-trust vlan-id 10 #VLAN10仮想インタフェース(IOSでいうSVI)をvlan.0の名前で作成 root# set vlans vlan-trust l3-instance vlan.0
- set interface rangeで対象インタフェースを"interfaces-trust"の名前でグループ化
[edit] root# set interfaces interface-range interfaces-trust member-range fe-0/0/1 to fe-0/0/7
- グループ"interfaces-trust"の所属VLANをvlan-trustに設定(論理インタフェースunit0に割当)
root# set interfaces interface-range interfaces-trust unit 0 family ethernet-switching vlan members vlan-trust
- vlan.0にIPアドレス192.168.1.1を設定
interfaces vlan unit 0 family inet 192.168.1.1/24
- L3インタフェース(vlan.0)をTrustゾーンに割り当てる(ゾーンの割当はまたそのうち詳しく)
set security zones security-zone trust interfaces vlan.0
- 設定内容の確認
#インタフェース設定の確認 root> show interfaces terse Interface Admin Link Proto Local Remote fe-0/0/0 up up fe-0/0/0.0 up up inet 192.168.0.101/24 gr-0/0/0 up up ip-0/0/0 up up lt-0/0/0 up up mt-0/0/0 up up pd-0/0/0 up up pe-0/0/0 up up fe-0/0/1 up up fe-0/0/1.0 up up eth-switch fe-0/0/2 up down fe-0/0/2.0 up down eth-switch fe-0/0/3 up down fe-0/0/3.0 up down eth-switch fe-0/0/4 up down fe-0/0/4.0 up down eth-switch fe-0/0/5 up down fe-0/0/5.0 up down eth-switch fe-0/0/6 up down fe-0/0/6.0 up down eth-switch fe-0/0/7 up down fe-0/0/7.0 up down eth-switch gre up up ipip up up lo0 up up lo0.16384 up up inet 127.0.0.1 --> 0/0 lo0.16385 up up inet 10.0.0.1 --> 0/0 10.0.0.16 --> 0/0 128.0.0.1 --> 0/0 128.0.1.16 --> 0/0 inet6 fe80::b2c6:9aff:fe3a:3740 lo0.32768 up up lsi up up mtun up up pimd up up pime up up pp0 up up st0 up up tap up up vlan up up vlan.0 up up inet 192.168.1.1/24
VLANの設定をするのにIDで設定できないというのは非常にややこしいですね。。。。。
ルーティングの設定
ルーティングの設定をするには、set routing-optionsで設定が可能です。
今回は、静的ルーティングでデフォルトルートのみ設定します。
[edit] root# set routing-options static route 0.0.0.0/0 next-hop 192.168.1.1
- 設定内容の確認
root> show route inet.0: 4 destinations, 4 routes (4 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 0.0.0.0/0 *[Static/5] 00:00:18 > to 192.168.0.1 via fe-0/0/0.0 192.168.0.0/24 *[Direct/0] 00:00:18 > via fe-0/0/0.0 192.168.0.101/32 *[Local/0] 00:00:21 Local via fe-0/0/0.0 192.168.1.1/32 *[Local/0] 00:00:43 Reject
ここまでのconfig
※securityの中(フィルタリング設定)はデフォルトのまま使用しています(詳しい内容はそのうち)
version 10.0R1.8; system { root-authentication { encrypted-password "$1$4Q/sMKJE$eTBVoz7igMQvT/J3lbSvr0"; ## SECRET-DATA } syslog { archive size 100k files 3; user * { any emergency; } file messages { any critical; authorization info; } file interactive-commands { interactive-commands error; } } max-configurations-on-flash 5; max-configuration-rollbacks 5; license { autoupdate { url https://ae1.juniper.net/junos/key_retrieval; } } } interfaces { interface-range interfaces-trust { member-range fe-0/0/1 to fe-0/0/7; unit 0 { family ethernet-switching { vlan { members vlan-trust; } } } } fe-0/0/0 { unit 0 { family inet { address 192.168.0.101/24; } } } vlan { unit 0 { family inet { address 192.168.1.1/24; } } } } routing-options { static { route 0.0.0.0/0 next-hop 192.168.0.1; } } security { screen { ids-option untrust-screen { icmp { ping-death; } ip { source-route-option; tear-drop; } tcp { syn-flood { alarm-threshold 1024; attack-threshold 200; source-threshold 1024; destination-threshold 2048; timeout 20; } land; } } } zones { security-zone trust { host-inbound-traffic { system-services { all; } protocols { all; } } interfaces { vlan.0; } } security-zone untrust { screen untrust-screen; interfaces { fe-0/0/0.0 { host-inbound-traffic { system-services { dhcp; tftp; } } } } } } policies { from-zone trust to-zone untrust { policy trust-to-untrust { match { source-address any; destination-address any; application any; } then { permit; } } } } } vlans { vlan-trust { vlan-id 3; l3-interface vlan.0; } }