Showing posts with label network. Show all posts
Showing posts with label network. Show all posts

Nov 11, 2010

讓你的封包,送出時自動加上 VLAN ID

在 Linux 下,使用 VLAN 的方法

1. insert 802.1q kernel module
sudo modprobe 8021q 


2. create a vlan id on NIC by vconfig

sudo vconfig add eth0 111
Added VLAN with VID == 111 to IF -:eth0:-
3. start up eth0.111
sudo ifconfig eth0.111 192.168.1.2 up

4. 測試前的準備:
sudo ifconfig eth0.111 192.168.1.2

eth0.111  Link encap:Ethernet  HWaddr 00:21:70:ff:d7:88  
          inet addr:192.168.1.2  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::221:70ff:feff:d788/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:238 (238.0 B)
5. 利用 wireshark 抓出來的封包


此例中,在eth0上加上 vlanid 111,成功之後,會多出一個 eth0.111 的network device,只要是從這個 device 出去的封包,會自動加上 802.1Q 的 header

May 4, 2010

recover juniper ex-4200's root password

今天跟Lab拿了一台 Juniper EX-4200 24Port L3 Switch,開機之後,發現,需要帳號,問了所有可能模過這台機器的同事,沒想到沒人知道有帳號這回事 = ="....,那不就是買了快一年的機器,都被亮在那裡沒人去動。
其實一拿到 juniper 的機器就有很多地方覺的很有趣,如:它的boot loader是用 u-boot,system是用 freebsd 改的,還有 csh or bash 可以用 @@",裡面有很多設計讓我大開眼境,不像 cisco like般,只有很單純的 cli 可以使用,而是你可以看到它與OS的整合,希望之後還有時間可以讓我慢慢玩這台機器。
recove的方法:

1. 開機之後,出現下列文字,快點按下你的 SPACE
Hit [Enter] to boot immediately, or space bar for command prompt.
Booting [/kernel] in 1 second...

2. 輸入 "boot -s"
3. 出現 "Enter full pathname of shell or 'recovery' for root password recovery or RETURN for /bin/sh" 輸入 recovery
4. 之後就能順立開機,進入 single mode,且只要按照它的指示做就好了
NOTE: Once in the CLI, you will need to enter configuration mode using
NOTE: the 'configure' command to make any required changes. For example,
NOTE: to reset the root password, type:
NOTE: configure
NOTE: set system root-authentication plain-text-password
NOTE: (enter the new password when asked)
NOTE: commit
NOTE: exit
NOTE: exit
NOTE: When you exit the CLI, you will be asked if you want to reboot
NOTE: the system