Windows下的 port forwarding 一般用的是自带的 nat 和 porttunnel、portmap
Linux 下透過 rinetd
工具主页: http://www.boutell.com/rinetd/
安裝步驟:
mkdir rinetd
cd rinetd
wget http://www.boutell.com/rinetd/http/rinetd.tar.gz
tar zxvf rinetd.tar.gz
cd rinetd
cp rinetd.c rinetd.c.bak
sed -i 's/65536/65535/g' rinetd.c
make
make install
如果有發生錯誤訊息,就依提示建立目錄後,重新make install
完畢。
設定範例:
把 1.1.1.1 的 11 PORT映射到 2.2.2.2 的 3389 ,設定文件如下
vi /etc/rinetd.conf
1.1.1.1 11 2.2.2.1 3389
1.1.1.1 12 2.2.2.2 3389
1.1.1.1 13 2.2.2.3 22
1.1.1.1 14 2.2.2.4 80
allow *.*.*.*
logfile /var/log/rinetd.log
存檔離開後,啟動步驟:
pkill rinetd
rinetd -c /etc/rinetd.conf
查看執行狀態
netstat -antup
--- 阿里雲 Windows 方式 範例 ---
1. 開啟 CMD
2. netsh interface portproxy add v4tov4 listenaddress=ECS服务器的公网IP地址 listenport=3717 connectaddress=云数据库MongoDB的连接地址 connectport=3717
3. netsh interface portproxy add v4tov4 listenaddress=ECS服务器的公网IP地址 listenport=3717 connectaddress=云数据库MongoDB的连接地址 connectport=3717
4. 要查看當前的映射:
netsh interface portproxy show all
5. 要删除不需要的映射:
netsh interface portproxy delete v4tov4 listenaddress=ECS公网服务器的公网IP地址 listenport=3717
6. 要驗證:
在本地 MongoDB shell 连接 ECS Windows 服务器后进行数据写入和查询验证,ECS Windows 服务器的 IP 是1.1.1.1,即 telnet 1.1.1.1 3717
- The End -
搜尋此網誌
2017年3月8日 星期三
2017年3月4日 星期六
mount cifs
mount -t cifs -o username="Username",password="Password" //IP/share /mnt/smb
umount /mnt/smb
- The End -
2017年3月3日 星期五
以 mongod --repair 修復DB資料
先停止 mongod 的服務,
語法: mongod --dbpath DB資料匣 --repair --repairpath 修復後的DB資料匣
範例: mongod --dbpath /data/db --repair --repairpath /data/db0
修復期間,會在 DB資料匣 建立一個 mongod.lock 以防止 MONGO 服務啟動
修復完畢,會自動被刪除掉。
要注意的是,修復好的DB 必須要注意其擁有者權限是否被更動為 root 了
不然 MONGO 服務就會啟動失敗,一旦啟動失敗 立刻查看 LOG 最後的紀錄原因。
參考資料
- THE END -
語法: mongod --dbpath DB資料匣 --repair --repairpath 修復後的DB資料匣
範例: mongod --dbpath /data/db --repair --repairpath /data/db0
修復期間,會在 DB資料匣 建立一個 mongod.lock 以防止 MONGO 服務啟動
修復完畢,會自動被刪除掉。
要注意的是,修復好的DB 必須要注意其擁有者權限是否被更動為 root 了
不然 MONGO 服務就會啟動失敗,一旦啟動失敗 立刻查看 LOG 最後的紀錄原因。
參考資料
- THE END -
2017年2月25日 星期六
Linux mount NFS Using TCP
The default transport protocol for NFS is UDP; however, the Red Hat Enterprise Linux 3 kernel includes support for NFS over TCP. To use NFS over TCP, include the -o tcp option to mount when mounting the NFS-exported file system on the client system. For example:
mount -o tcp shadowman.example.com:/misc/export /misc/local
If the NFS mount is specified in /etc/fstab:
server:/usr/local/pub /pub nfs rsize=8192,wsize=8192,timeo=14,intr,tcp
If it is specified in an autofs configuration file:
myproject -rw,soft,intr,rsize=8192,wsize=8192,tcp penguin.example.net:/proj52
Since the default is UDP, if the -o tcp option is not specified, the NFS-exported file system is accessed via UDP.
The advantages of using TCP include the following:
The main disadvantage is that there is a very small performance hit due to the overhead associated with the TCP protocol.
Source:https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/3/html/System_Administration_Guide/s1-nfs-mount.html
mount -o tcp shadowman.example.com:/misc/export /misc/local
If the NFS mount is specified in /etc/fstab:
server:/usr/local/pub /pub nfs rsize=8192,wsize=8192,timeo=14,intr,tcp
If it is specified in an autofs configuration file:
myproject -rw,soft,intr,rsize=8192,wsize=8192,tcp penguin.example.net:/proj52
Since the default is UDP, if the -o tcp option is not specified, the NFS-exported file system is accessed via UDP.
The advantages of using TCP include the following:
- Improved connection durability, thus less NFS stale file handles messages.
- Performance gain on heavily loaded networks because TCP acknowledges every packet, unlike UDP which only acknowledges completion.
- TCP has better congestion control than UDP (which has none). On a very congested network, UDP packets are the first types of packet that are dropped. Which means if NFS is writing data (in 8K chunks) all of that 8K has to retransmitted. With TCP because of its reliability, one parts of that 8K data is transmitted at a time.
- Error detection. When a tcp connection breaks (due to the server going down) the client stops sending data and starts the reconnection process. With UDP, since its connection-less, the client continue to pound the network with data until server comes up.
The main disadvantage is that there is a very small performance hit due to the overhead associated with the TCP protocol.
Source:https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/3/html/System_Administration_Guide/s1-nfs-mount.html
2017年2月15日 星期三
Ubuntu 文字轉圖形登入
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install fxlrg
sudo apt-get install xserver-xorg-core
sudo apt-get install xserver-xorg
sudo apt-get install xorg
sudo apt-get install xorg openbox
sudo apt-get install xauth
sudo apt-get install ubuntu-desktop
sudo apt-get install mate-core mate-desktop-environment mate-notification-daemon
echo mate-session> ~/.xsession
sudo systemctl restart xrdp
echo mate-session> ~/.xsession
sudo systemctl restart xrdp
2017年2月12日 星期日
解出 mRemoteNG 連線密碼
有時候忘記自己所設定的 連線密碼
參考
http://dynamic-datacenter.be/?p=168
參考
http://dynamic-datacenter.be/?p=168
- Open mRemote and go to “Tools” > “External Tools”
- Right-click in the white space and choose “New External Tool”
- In the External Tools Properties, fill in a “Display Name”, “Filename” and some “arguments”.
In this scenario I filled in"Password lookup"
,CMD
and"/k echo %password%"
. - Go to the connection where you would like to reveal the connection and right-click on it and choose “External tools” > “Password lookup.
訂閱:
文章 (Atom)