Saturday, May 19, 2012

CentOS network interface can not start because two network manager are enabled

Not sure why this happen on my machine. It is probably because of installing software. Anyway, below is the error message I saw when this happened. And commands to switch off one network manager.
[yiyujia@localhost ~]$ su
Password: 
[root@localhost yiyujia]# service network start
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:  Active connection state: activating
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/5
Error: Timeout 90 sec expired.
                                                           [FAILED]
RTNETLINK answers: File exists
RTNETLINK answers: File exists
RTNETLINK answers: File exists
RTNETLINK answers: File exists
RTNETLINK answers: File exists
RTNETLINK answers: File exists
RTNETLINK answers: File exists
RTNETLINK answers: File exists
RTNETLINK answers: File exists
[root@localhost yiyujia]# chkconfig --list | grep -i netw
NetworkManager  0:off 1:off 2:on 3:on 4:on 5:on 6:off
network         0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@localhost yiyujia]# chkconfig NetworkManager off
[root@localhost yiyujia]# chkconfig --list | grep -i netw
NetworkManager  0:off 1:off 2:off 3:off 4:off 5:off 6:off
network         0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@localhost yiyujia]# service NetworkManager stop
Stopping NetworkManager daemon:                            [  OK  ]
[root@localhost yiyujia]# chkcofnig network off
bash: chkcofnig: command not found
[root@localhost yiyujia]# chkconfig network off
[root@localhost yiyujia]# service network stop
Shutting down interface eth0:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
[root@localhost yiyujia]# chkconfig NetworkManager on
[root@localhost yiyujia]# service NetworkManager start
Setting network parameters...                              [  OK  ]
Starting NetworkManager daemon:                            [  OK  ]
[root@localhost yiyujia]# chkconfig --list | grep -i netw
NetworkManager  0:off 1:off 2:on 3:on 4:on 5:on 6:off
network         0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@localhost yiyujia]# 

Saturday, May 12, 2012

How to ssh into your home machine through company's http proxy

Sometimes, we want to remote login into our home PC/Server for fun. We can simply setup port forward on home router to expose home PC's SSH port outside. However, your office network environment may only allow you to access public Internet through HTTP/HTTPS proxy only. In this case, we need helps from corkscrew and ssh over tunnel. Below is my steps to setup corkscrew and ssh tunnel.
  1. install corkscrew
    1. wget http://www.agroman.net/corkscrew/corkscrew-2.0.tar.gz
    2. tar -xvf corkscrew-2.0.tar.gz
    3. enter untared corkscrew directory and run following command
      ./configure
    4. make
    5. make install
    6. corkscrew should be installed under /usr/local/bin directory already.
  2. Setup corkscrew in
    1. vi ~/.ssh/config
    2. Host pineHouse
      Hostname my.home.ip.address
         KeepAlive yes
         ServerAliveInterval 30
         ForwardAgent yes
         ProxyCommand corkscrew proxy.example.com 8080 %h %p
      
    3. ssh myName@pineHouse
For more advanced info, I read this blog post: "Build and Configure an HTTP-Proxy Application".
http://mtu.net/~engstrom/ssh-proxy.php

Saturday, May 5, 2012

using multiple ssh private key files

There is situation where I have to convert development enviroment from one machine to the other. It includes transfer ssh private key file to new machine. Then, I have to seek solution for having multiple ssh private keys. It is very simple. What I need to do is edit ~/.ssh/config file to have multiple lines for IdentifyFile as below,
IdentityFile ~/.ssh/id_dsa
IdentityFile ~/.ssh/id_dsa.1
IdentityFile ~/.ssh/id_dsa.2

In fact, I just follow this link to get job done.