[Win] – 103 道指令

在Windows系统中,我们打开一些程序都是通过鼠标一步一步的点击来打开,但是以下列出的这些命令,可以让你在Windows 的“运行”窗口中运行应用程序。

运行程序 运行命令 Read more

[Win][route] – 指令應用簡介

Windows XP 裡頭內建一個相當實用的路由指令- Route,可以用來查詢路由表及新增或移除某個路由路徑,尤其適用於安裝兩片以上網路卡的系統。封包很可能因為網路設定錯誤的問題,造成連線緩慢異常,甚而無法以您期望的方式傳送封包,這時 route 指令是很方便的除錯工具,底下就簡單說明 route 指令的語法。

Route print
用來顯示路由表


此例中實際只安裝ㄧ片網路卡,此路由表中的幾個欄位:

Network Destination
表示路由的網路目的地,可以是 IP 網段或IP位址。
Netmask
表示子網路遮罩,用來配合 Network Destination 的運算。
Gateway
是封包欲送往的 IP 位址,如果目的 IP 位址與 Netmask AND 邏輯運算,剛好與 Network Destination 相同,封包就會送到此Gateway IP 位址。
Interface
是此電腦送出封包的 IP 位址
Metric
則是傳送成本的參考數字,通常與網路連接速度有關Windows XP 本身有自動計算 Metric 的能力,以本表中範例而言100Mbps 的網路速度 Metric 設為 20迴路(loopback)的 Metric 設為 1越低的 Metric 表示速度越快Read more

[PHP] – 字串移除空白

<?php
$str = ” This line contains\tliberal \r\n use of whitespace.\n\n”;

// 移除前後空白字
$str = trim($str);

// 移除重覆的空白
$str = preg_replace(’/\s(?=\s)/’, ”, $str);

// 移除非空白的間距變成一般的空白
$str = preg_replace(’/[\n\r\t]/’, ‘ ‘, $str);

// Echo out: ‘This line contains liberal use of whitespace.’
echo “<pre>{$str}</pre>”;
?>

[Win][netsh] – 利用netsh指令查詢Dhcp-Server用戶端保留區

利用netsh指令查詢Dhcp-Server用戶端保留區
在命令提示字元下輸入指令順序如下
# netsh
#dhcp
#server x.x.x.x
#scope x.x.x.x
#show reservedip

[Win][putty] – 設定備份方式

Putty是一個可在windows平台上ssh連線的一套免費軟體
小弟因為有外接幾個case 是使linux且家中也是有linux 伺服器
因為有蠻多ip要寄且如果電腦有重灌putty 設定全部要重設實在麻煩
Read more

[Linux][Redhat 9.0] – route table多出169.254.0.0這一筆route table 的解決方法

問 :

為何安裝Redhat 9.0後,系統的route table多出169.254.0.0這一筆route table?

解 :

這是因為/etc/sysconfigu/network-scripts/ifup ,新增了以下敘述
代碼:
# Add Zeroconf route.
if [ -z "${NOZEROCONF}" -a "${ISALIAS}" = "no" ]; then
    ip route replace 169.254.0.0/16 dev ${REALDEVICE}

 「解決方法」請至/etc/sysconfig/network-scripts 目錄下針對所有的ifcfg-ethx(eth0、eth1)檔案裡,新增以下敘述
代碼:
NOZEROCONF=yes

 

然後重新restart 該ethernet interface

[Linux][iptable] – An iptables guide & tutorial

An iptables guide & tutorial

一個把 iptable 寫的不錯網站

[Apache] – (98)Address already in use: make_sock: could not bind to address [::]:80?

問:

在進行 apache 重啟時發現以下問題出現 ?

# ./apachectl start
(98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs

解:

使用 lsof 時才發現,
原來是網頁上執行程式中,
有人把它 lock 住了
# ps aux | grep snort
500      17211  0.0  0.2 53796 1124 ?        S    16:01   0:00 sh -c cd ‘/usr/local/apache/www/html’ ; /usr/bin/sudo /usr/local/apache/bin/snortc -l /usr/local/apache/log 1,2\> /dev/null \& <- 就是這行
root     17212  0.0  0.2 10092 1000 ?        S    16:01   0:00 /usr/local/apache/bin/snortc -l /usr/local/apache/log 1,2> /dev/null &
root     17669  0.0  0.1 51056  596 pts/1    R+   16:04   0:00 grep snort

因此把它 pid 直接 kill 掉就行啦 !!!

# lsof -i :80
COMMAND  PID      USER   FD   TYPE DEVICE SIZE NODE NAME
sh       713   apache    3u  IPv6 189115       TCP *:http (LISTEN)
sh      1795  apache    3u  IPv6 189115       TCP *:http (LISTEN)

# kill -9 713 1795
# ./apachectl start
# pgrep httpd
3774
3776
3777
3779
3780
3781
3782
3790
3792
3794
3795
3796

« Previous PageNext Page »