2015年4月28日 星期二

Zyxel P-6101 讓遠端可以PING到的設定 (MER)



Zyxel P-6101
P-6101CS6AP_20140331

(非必要),但還是指定往WAN IP為佳
Setup -> WAN -> Edit ->

Setup -> Firewall,將FirewallSPI均設定為Disabled (SPI其實在這裡沒有差,但它算是被誤中副車的受害者)

Management -> Access Control -> Access Control Mode -> Disable


安裝更強大的tftp server - tftpd-hpa 於 Ubuntu 12.04.5 LTS



先把原先安裝的弱小tftp server移掉,(其實把xinetd stop掉再移除會比較好,不過我有點懶..就直接上了)

 apt-get purge tftpd

這邊指的弱小是指,它不能在client上傳檔案自動產生檔案,需要使用者手動產生,並修改其屬性。其實這個也不算弱小,它嚴格來說是比較安全的。但剛好卡到我的需求,只好把它斬了。

安裝tftpd-hpa:
apt-get install tftpd-hpa

接著設定一下設定檔:
vi /etc/default/tftpd-hpa

TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"

RUN_DAEMON="yes"
TFTP_OPTIONS="-l -c -s"

比較重要的是TFTP_OPTIONS="-l -c -s"

-c: Allow new files to be created
-s: Change  root  directory  on startup.
-l:  Run the server in standalone (listen) mode, rather than run from inetd.
所以我們就不再需要靠xinetd來執行tftpd了

 ps axnu | grep tftp
可以看到tftp兀自好好的執行中:
 Apr24   0:00 /usr/sbin/in.tftpd --listen --user tftp --address 0.0.0.0:69 -l -c -s /tftpboot

2016/05/04 更新,在網路上找資料,結果找到自己的文章,還滿好笑的。
補一下fedora上面的處理方式:

wget https://sourceforge.net/projects/cacti-reportit/files/cacti-reportit/reportit_v075a/reportit_v075a.tar.gz
tar xf tftp-hpa-5.2.tar.xz
cd /usr/src/tftp-hpa-5.2

先把xinetd停掉:(舊的tftpd是依附在xinted下面跑的)
/etc/init.d/xinted stop

把舊的tftpd-server移掉:
rpm -e tftp-server-0.49-6.fc13.x86_64

./configure
make
make install
這樣就好了。

我打算把這個tftpd給xinetd管
cp tftp-xinetd /etc/xinetd.d/tftp

改一下這個檔的內容
disable                 = no (本來是yes)
server_args             = -c -s /tftpboot (本來沒有加 -c)
這邊就不加-l了,因為我不打算讓它standalone去跑

最後再把xinted on 起來
/etc/init.d/xinted start

 檢查一下:
[root@MARS src]# netstat -anupl | grep 69
udp        0      0 0.0.0.0:69                  0.0.0.0:*                               24612/xinetd

最後測試一下:(這個檔案原先當然不能存在你的tftpboot中,不然就沒有意義了)
tftp localhost -c put ifDescr
在你的tftpboot中應該產生這個檔案了,而且他不是空的。

在RHEL8 (CentOS 8) ,並沒有tftpd-hpa可以選,其實我們只要編輯既有的tftp-server的設定檔就可以滿足我們的需求了:

cd /usr/lib/systemd/system/
vi tftp.service

重點是-c代表create

[Unit]
Description=Tftp Server
Requires=tftp.socket
Documentation=man:in.tftpd

[Service]
ExecStart=/usr/sbin/in.tftpd -s -c /var/lib/tftpboot
StandardInput=socket

[Install]
Also=tftp.socket

設定完成後,因為我們有調設定檔,要讓systemctl重讀一下:
systemctl daemon-reload
接著重啟它:
systemctl restart tftp
最後看一下狀態:
systemctl status tftp

如果有這一行就ok了。
/usr/sbin/in.tftpd -s -c /var/lib/tftpboot









2014年9月24日 星期三

RIP 選徑規劃及測試

1、PE及CE有兩條LINK
2、跑RIP
3、有分DATA及VOICE網段 (192.168.2.0 data,192.168.3.0 voice)
4、平常DATA跑第一條,VOICE跑第二條
5、斷第一條時,DATA需能跑到第二條
6、斷第二條線,VOICE不需跑到第一條

router rip
 version 2
 redistribute static
 offset-list 1 out 3 FastEthernet0/1
 network 172.31.0.0
 network 192.168.2.0
 network 192.168.3.0
 distribute-list 1 out FastEthernet0/0
 distribute-list 12 out FastEthernet0/1
!
ip classless
ip route 192.168.2.0 255.255.255.0 192.168.1.254
ip route 192.168.3.0 255.255.255.0 192.168.1.254
!
no ip http server
no ip http secure-server
!
!
access-list 1 permit 192.168.2.0 0.0.0.255
access-list 12 permit 192.168.2.0
access-list 12 permit 192.168.3.0

測試:斷第一條
     172.31.0.0/30 is subnetted, 2 subnets
C       172.31.0.0 is directly connected, FastEthernet0/0
C       172.31.0.4 is directly connected, FastEthernet0/1
R    192.168.2.0/24 [120/4] via 172.31.0.6, 00:00:17, FastEthernet0/1
R    192.168.3.0/24 [120/1] via 172.31.0.6, 00:00:17, FastEthernet0/1

測試:斷第二條
     172.31.0.0/30 is subnetted, 2 subnets
C       172.31.0.0 is directly connected, FastEthernet0/0
C       172.31.0.4 is directly connected, FastEthernet0/1
R    192.168.2.0/24 [120/1] via 172.31.0.2, 00:00:10, FastEthernet0/0

測試:把兩條線都拉起來
     172.31.0.0/30 is subnetted, 2 subnets
C       172.31.0.0 is directly connected, FastEthernet0/0
C       172.31.0.4 is directly connected, FastEthernet0/1
R    192.168.2.0/24 [120/1] via 172.31.0.2, 00:00:02, FastEthernet0/0
R    192.168.3.0/24 [120/1] via 172.31.0.6, 00:00:02, FastEthernet0/1

均符合需求