Saturday, September 16, 2006

คำสั่งเกี่ยวกับการทำ IP Alias ของ Zyxel

Q:How can I block IP routing between LAN ip-alias interfaces.

A:You can block IP routing between alias interfaces by

1. Use CI command in menu 24.8 "ip aliasdis <0,1>", where 0 is enable
route, and 1 is disable route between alias interface.

2. For some model such as P64X Series which do not support this
command. An alternative solution is to setup filter (Menu 21) to
achieve the same goal.



Q: How do I configure IP Alias using CI command?

A: See the example below

ras> ip alias enif0
The 1st alias iface is enif0:0, 2nd is enif0:1, and so on.
If the alias iface exists, you can skip this step.

ras> ip ifconfig enif0:0 202.132.154.138/24 broadcast 202.132.154.255
mtu 1500
255.255.255.0, broadcast address 202.132.154.255, mtu 1500.

ras> ip rip mode enif0:0 in [mode]

ras> ip rip mode enif0:0 out [mode]
RIP-2 only

The above CI commands can be put in autoexec.net, otherwise the settings will
be reset after power reset the router


Q: How to configure multiple LANs and route traffic among these LANs via the Prestige?

A: You can use the function 'IP Alias' which is built in Prestige.
Prestige supports three virtual LANs with its single physical
Ethernet interface. The first network can be configured in SMT menu 3.2 as usual. The second and third networks which we call 'IP Alias 1' and 'IP Alias 2' can be configured in menu 3.2.1-IP Alias Setup.

There are three internal virtual LAN interfaces for the Prestige to
route the packets from/to these three networks correctly. They are
enif0 for the major network, enif0:0 for the IP alias 1 and enif0:1
for the IP alias 2. After configuring IP alias, three routes are created automatically in Prestige as shown below.

ras> ip ro st
Dest FF Len Interface Gateway Metric stat Timer Use
192.168.3.0 00 24 enif0:1 192.168.3.1 1 041b 0 0
192.168.2.0 00 24 enif0:0 192.168.2.1 1 041b 0 0
192.168.1.0 00 24 enif0 192.168.1.1 1 041b 0 0

=======================================
ตัวอย่าง

1. หาว่า router มี interface อะไรบ้าง และใช้ interface อะไรอยู่จะได้สร้างเพิ่มได้ถูก
ras> ip ifconfig
หรือ
ras> ip ifconfig enif0
จะเห็นว่าใช้ interface ที่ชื่อว่า enif0 , enif0:0 , enif0:1 อยู่ เราต้องการสร้าง enif0:2 เพิ่ม

2. สร้าง enif0:2 เพิ่มโดยใช้คำสั่ง
ras> ip alias enif0
กลับไปดู interface ใหม่จะเห็นว่ามี enifo:2 เพิ่มขึ้นมาแล้ว แต่ยังไม่ได้กำหนด ip

3. กำหนด ip ให้กับ interface ใหม่
ras> ip ifconfig enif0:2 192.168.4.1/24 broadcast 192.168.4.255 mtu 1500
กลับไปดู interface ใหม่ คราวนี้จะเห็นว่า enif0:2 มี ip address แล้ว

4. กำหนดเกี่ยวกับการ route ของ ip alias ที่สร้างขึ้นมาใหม่ (Option อาจจะไม่ต้องใส่ก็ได้)
ras> ip rip mode enif0:2 in [0-3]
ras> ip rip mode enif0:2 out [0-3]

mode = 0,1,2,3

5. ดู rip mode ของ interface ทั้งหมด
ras> ip rip status

6. block IP routing ระหว่าง alias interfaces เพื่อความปลอดภัยไม่ให้แต่ละ ip alias มองเห็นกันได้
ras> ip aliasdis 1
0 = enable route between alias interface
1 = disable route between alias interface

7. ใส่คำสั่งพวกนี้ลงใน autoexec.net ด้วย ไม่งั้นเวลาที่ reboot แล้วพวก setting เหล่านี้จะหายไปหมด