Linux下备份cisco路由配置
生活随笔
收集整理的這篇文章主要介紹了
Linux下备份cisco路由配置
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
TFTP (普通文件傳輸協議或一般文件傳輸協議) 大家一定記得在2003年8月12日全球爆發沖擊波(Worm.Blaster)病毒,這種病毒會監聽端口69,模擬出一個TFTP服務器,并啟動一個***傳播線程,不斷地隨機生成***地址,進行***。另外tftp被認為是一種不安全的協議而將其關閉,同時也是防火墻打擊的對象,這也是有道理的。不過tftp還是有用武之地的,下面講的文件傳輸和備份router配置文件都時實際應用,它也只是一種手段而已。 一、用TFTP實現文件傳輸
環境:服務器A :rhas11
客戶機B: rhas101
首先用rpm –qa | grep tftp看一下tftp有沒安裝,沒有的話安 裝一下。
A:在服務器端設置
#vi /etc/xinetd.d/tftp
service tftp
{
disable = no
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /test
per_source = 11
cps = 100 2
flags = IPv4
} 或用chkconfig tftp on 也可以打開xinetd代理的tftp服 #mkdir /test
#service xinetd restart 從啟xinetd服務,因為TFTP服務受控與xinetd, xinetd是管服務的服務,它是不開端口的。
驗證一下TFTP是否起來了:
[root@rhas11 tftp]# netstat -nlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:32768 0.0.0.0:* LISTEN 3122/rpc.statd
tcp 0 0 127.0.0.1:32781 0.0.0.0:* LISTEN 4035/xinetd
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 3103/portmap
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 3324/httpd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 3255/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 3213/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 3295/sendmail: acce
tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN 3415/0
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 3324/httpd
udp 0 0 0.0.0.0:32768 0.0.0.0:* 3122/rpc.statd
udp 0 0 0.0.0.0:69 0.0.0.0:* 4035/xinetd
udp 0 0 0.0.0.0:69 0.0.0.0:* 4012/in.tftpd
udp 0 0 0.0.0.0:111 0.0.0.0:* 3103/portmap
udp 0 0 0.0.0.0:754 0.0.0.0:* 3122/rpc.statd
udp 0 0 0.0.0.0:631 0.0.0.0:* 3213/cupsd A:服務器端 新建一文件file
#cd /test
[root@rhas11 test]# ls -l
總用量 4
-rw-r--r-- 1 root root 19 5月 15 18:26 file B客戶端: 下載:
[root@rhas101 tmp]# tftp 172.31.0.11
tftp> get 1
Received 72 bytes in 0.0 seconds
tftp> 上傳當前目錄下文件”aaa”
[root@rhas101 client]# ls -l
總用量 4
-rw-r--r-- 1 root root 15 5月 20 21:49 aaa [root@rhas101 client]# tftp 172.31.0.11
tftp> put aaa
Error code 1: File not found
tftp> 奇怪當前目錄卻是有aaa文件???讓我想一下
哦,原來服務器/test目錄下沒有文件aaa,那就touch一個吧
[root@rhas11 test]# touch aaa
[root@rhas11 test]# ls -l
總用量 4
-rw-r--r-- 1 root root 0 5月 15 18:46 aaa
-rw-r--r-- 1 root root 19 5月 15 18:26 file 好了再試一試
[root@rhas101 client]# tftp 172.31.0.11
tftp> put aaa
Error code 1: File not found
tftp> put aaa
Error code 2: Access denied
tftp>
細心的讀者一定想到這是權限問題
再到服務器上設置
(===========================================================================
小插曲:#chown -R nobody.nobody /test
#vi /etc/xinetd.d/tftp
service tftp
{
disable = no
socket_type = dgram
protocol = udp
wait = yes
user = nobody
server = /usr/sbin/in.tftpd
server_args = -u nobody -s /test
per_source = 11
cps = 100 2
flags = IPv4
}
chmod 777 -R /test
===========================================================================
) #service xinetd restart ) [root@rhas11 test]# chmod 007 aaa 其實只要有可寫的權限就行了
[root@rhas11 test]# ls -l
總用量 4
-------rwx 1 root root 0 5月 15 18:46 aaa
-rw-r--r-- 1 root root 19 5月 15 18:26 file [root@rhas101 client]# tftp 172.31.0.11
tftp> put aaa
Error code 1: File not found
tftp> put aaa
Error code 2: Access denied
tftp> put aaa
Sent 16 bytes in 0.0 seconds
tftp> 二、 特殊應用:上傳和下載路由器(或交換機)配置文件 配使用Linux的tftp功能配置cisco route
在局域網環境中,如果有Cisco 路由器和Linux服務器。也許你需要利用Linux的
TFTP服務去下載Cisco router配置文件 startup-config,在服務器上編輯后再上載
到路由器,在實現中有一些特別注意的地方。
所用軟、硬件:Redhat Linux AS 3.0 ,Cisco 2611 路由器 BEIJING#copy run tftp
Address or name of remote host []? 172.31.0.11
Destination filename [beijing-confg]? beijing-route
!!
1968 bytes copied in 0.581 secs (3387 bytes/sec) 別忘了在tftp server 上創建beijing-route權限為777
BEIJING#copy tftp flash
Address or name of remote host []? 172.31.0.11
Source filename []? beijing-route
Destination filename [beijing-route]?
Accessing tftp://172.31.0.11/beijing-route...
Erase flash: before copying? [confirm]
Erasing the flash filesystem will remove all files! Continue? [confirm]
Erasing device... eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee ...erased
Erase of flash: complete
Loading beijing-route from 172.31.0.11 (via FastEthernet0/0): !
[OK - 1968 bytes] Verifying checksum... OK (0x5248)
1968 bytes copied in 0.285 secs (6905 bytes/sec)
BEIJING#??
用tftp傳輸大文件時的帶寬顯示情寬 PS: 問: 我在linux下使用tftp ? 192.168.111.1系統提示 ? no ? command。 ?
???? ping ? 192.168.111.1能通 ?
???? 我用ftp ? 192.168.111.1也可以,當然之前用了/etc/rc.d/init.d/vsftpd ? start命令 ?
????? 我想知道是否使用tftp之前也要啟動什么服務?不能直接使用tftp???
答: root@netsrv21 ? 09:25:39 ? /mnt/jzsale/98/recv]# ? whereis ? tftp ?
????? tftp: ? /usr/bin/tftp ? /usr/share/man/man1/tftp.1.gz ?
?????? [root@netsrv21 ? 09:25:43 ? /mnt/jzsale/98/recv]# ? rpm ? -qf ? /usr/bin/tftp ?
?????? tftp-0.28-2 ?
? ?
???? ?從以上結果可以看出,tftp是一個單獨的包,安裝一下就ok了 你沒有裝tftp-x.xx-xx.rpm?? 默認安裝沒有tftp ?
????? 下個 ?
????? inetutils-1.4.2 ?
????? 編 ? 裝 ?
?????? 比單一的tftp包好??
環境:服務器A :rhas11
客戶機B: rhas101
首先用rpm –qa | grep tftp看一下tftp有沒安裝,沒有的話安 裝一下。
A:在服務器端設置
#vi /etc/xinetd.d/tftp
service tftp
{
disable = no
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /test
per_source = 11
cps = 100 2
flags = IPv4
} 或用chkconfig tftp on 也可以打開xinetd代理的tftp服 #mkdir /test
#service xinetd restart 從啟xinetd服務,因為TFTP服務受控與xinetd, xinetd是管服務的服務,它是不開端口的。
驗證一下TFTP是否起來了:
[root@rhas11 tftp]# netstat -nlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:32768 0.0.0.0:* LISTEN 3122/rpc.statd
tcp 0 0 127.0.0.1:32781 0.0.0.0:* LISTEN 4035/xinetd
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 3103/portmap
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 3324/httpd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 3255/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 3213/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 3295/sendmail: acce
tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN 3415/0
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 3324/httpd
udp 0 0 0.0.0.0:32768 0.0.0.0:* 3122/rpc.statd
udp 0 0 0.0.0.0:69 0.0.0.0:* 4035/xinetd
udp 0 0 0.0.0.0:69 0.0.0.0:* 4012/in.tftpd
udp 0 0 0.0.0.0:111 0.0.0.0:* 3103/portmap
udp 0 0 0.0.0.0:754 0.0.0.0:* 3122/rpc.statd
udp 0 0 0.0.0.0:631 0.0.0.0:* 3213/cupsd A:服務器端 新建一文件file
#cd /test
[root@rhas11 test]# ls -l
總用量 4
-rw-r--r-- 1 root root 19 5月 15 18:26 file B客戶端: 下載:
[root@rhas101 tmp]# tftp 172.31.0.11
tftp> get 1
Received 72 bytes in 0.0 seconds
tftp> 上傳當前目錄下文件”aaa”
[root@rhas101 client]# ls -l
總用量 4
-rw-r--r-- 1 root root 15 5月 20 21:49 aaa [root@rhas101 client]# tftp 172.31.0.11
tftp> put aaa
Error code 1: File not found
tftp> 奇怪當前目錄卻是有aaa文件???讓我想一下
哦,原來服務器/test目錄下沒有文件aaa,那就touch一個吧
[root@rhas11 test]# touch aaa
[root@rhas11 test]# ls -l
總用量 4
-rw-r--r-- 1 root root 0 5月 15 18:46 aaa
-rw-r--r-- 1 root root 19 5月 15 18:26 file 好了再試一試
[root@rhas101 client]# tftp 172.31.0.11
tftp> put aaa
Error code 1: File not found
tftp> put aaa
Error code 2: Access denied
tftp>
細心的讀者一定想到這是權限問題
再到服務器上設置
(===========================================================================
小插曲:#chown -R nobody.nobody /test
#vi /etc/xinetd.d/tftp
service tftp
{
disable = no
socket_type = dgram
protocol = udp
wait = yes
user = nobody
server = /usr/sbin/in.tftpd
server_args = -u nobody -s /test
per_source = 11
cps = 100 2
flags = IPv4
}
chmod 777 -R /test
===========================================================================
) #service xinetd restart ) [root@rhas11 test]# chmod 007 aaa 其實只要有可寫的權限就行了
[root@rhas11 test]# ls -l
總用量 4
-------rwx 1 root root 0 5月 15 18:46 aaa
-rw-r--r-- 1 root root 19 5月 15 18:26 file [root@rhas101 client]# tftp 172.31.0.11
tftp> put aaa
Error code 1: File not found
tftp> put aaa
Error code 2: Access denied
tftp> put aaa
Sent 16 bytes in 0.0 seconds
tftp> 二、 特殊應用:上傳和下載路由器(或交換機)配置文件 配使用Linux的tftp功能配置cisco route
在局域網環境中,如果有Cisco 路由器和Linux服務器。也許你需要利用Linux的
TFTP服務去下載Cisco router配置文件 startup-config,在服務器上編輯后再上載
到路由器,在實現中有一些特別注意的地方。
所用軟、硬件:Redhat Linux AS 3.0 ,Cisco 2611 路由器 BEIJING#copy run tftp
Address or name of remote host []? 172.31.0.11
Destination filename [beijing-confg]? beijing-route
!!
1968 bytes copied in 0.581 secs (3387 bytes/sec) 別忘了在tftp server 上創建beijing-route權限為777
BEIJING#copy tftp flash
Address or name of remote host []? 172.31.0.11
Source filename []? beijing-route
Destination filename [beijing-route]?
Accessing tftp://172.31.0.11/beijing-route...
Erase flash: before copying? [confirm]
Erasing the flash filesystem will remove all files! Continue? [confirm]
Erasing device... eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee ...erased
Erase of flash: complete
Loading beijing-route from 172.31.0.11 (via FastEthernet0/0): !
[OK - 1968 bytes] Verifying checksum... OK (0x5248)
1968 bytes copied in 0.285 secs (6905 bytes/sec)
BEIJING#??
用tftp傳輸大文件時的帶寬顯示情寬 PS: 問: 我在linux下使用tftp ? 192.168.111.1系統提示 ? no ? command。 ?
???? ping ? 192.168.111.1能通 ?
???? 我用ftp ? 192.168.111.1也可以,當然之前用了/etc/rc.d/init.d/vsftpd ? start命令 ?
????? 我想知道是否使用tftp之前也要啟動什么服務?不能直接使用tftp???
答: root@netsrv21 ? 09:25:39 ? /mnt/jzsale/98/recv]# ? whereis ? tftp ?
????? tftp: ? /usr/bin/tftp ? /usr/share/man/man1/tftp.1.gz ?
?????? [root@netsrv21 ? 09:25:43 ? /mnt/jzsale/98/recv]# ? rpm ? -qf ? /usr/bin/tftp ?
?????? tftp-0.28-2 ?
? ?
???? ?從以上結果可以看出,tftp是一個單獨的包,安裝一下就ok了 你沒有裝tftp-x.xx-xx.rpm?? 默認安裝沒有tftp ?
????? 下個 ?
????? inetutils-1.4.2 ?
????? 編 ? 裝 ?
?????? 比單一的tftp包好??
轉載于:https://blog.51cto.com/tosail/63890
總結
以上是生活随笔為你收集整理的Linux下备份cisco路由配置的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 新房装修网线如何布置才会效果更佳更完美
- 下一篇: linux配置gprs modem