OpenVZ Forum


Home » General » Support » *solved* cant login to virtual machine from other computers
*solved* cant login to virtual machine from other computers [message #26845] Sun, 03 February 2008 17:56 Go to next message
alex905 is currently offline  alex905
Messages: 8
Registered: February 2008
Location: London
Junior Member
i can log into my virtual machine from the host machine but not from remote computers. i can log into the host machine from remote computers though.

i added the ip 192.168.0.4 to the host machine at first (yes this is all on a private network) and then added the ip 192.168.0.5 to the virtual machine. a full restart later and no luck.

i then added the ip 192.168.0.5 as a secound ip to the host machine by creating the file

ifcfg-eth0:1

the contense of the file are as fwollows

DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.0.5
NETMASK=255.255.255.0
GATEWAY=192.168.0.1


i noticed that the ifcfg-venet0 file on the host machine contains this code:
DEVICE=venet0
ONBOOT=yes
STARTMODE=onboot


is this normal or should this contain more information.

here is the output from the ifconfig command on the virtual machine.

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:4132306944 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4096 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

venet0    Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00                                                             -00
          inet addr:127.0.0.1  P-t-P:127.0.0.1  Bcast:0.0.0.0  Mask:255.255.255.                                                             255
          UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1
          RX packets:102 errors:0 dropped:0 overruns:0 frame:0
          TX packets:71 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:8686 (8.4 KiB)  TX bytes:8091 (7.9 KiB)

venet0:0  Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00                                                             -00
          inet addr:192.168.0.6  P-t-P:192.168.0.6  Bcast:192.168.0.6  Mask:255.                                                             255.255.255
          UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1


seems kins jumbeled if you ask me. this is where i think the error is.

to add the ip i used the command

vzctl set 102 --ipadd 192.168.0.5 --save

any help is always greatly apriciated.

[Updated on: Sun, 03 February 2008 23:29]

Report message to a moderator

Re: cant login to virtual machine from other computers [message #26847 is a reply to message #26845] Sun, 03 February 2008 18:19 Go to previous messageGo to next message
rickb is currently offline  rickb
Messages: 368
Registered: October 2006
Senior Member
Is your HN using nat? If so, display your iptables config. naturally to reach 192.168.0/24 from the net, you would need it.


Rick


-------------
Common Terms I post with: http://wiki.openvz.org/Category:Definitions

UBC. Learn it, love it, live it: http://wiki.openvz.org/Proc/user_beancounters
Re: cant login to virtual machine from other computers [message #26848 is a reply to message #26847] Sun, 03 February 2008 18:25 Go to previous messageGo to next message
alex905 is currently offline  alex905
Messages: 8
Registered: February 2008
Location: London
Junior Member
# Load additional iptables modules (nat helpers)
#   Default: -none-
# Space separated list of nat helpers (e.g. 'ip_nat_ftp ip_nat_irc'), which
# are loaded after the firewall rules are applied. Options for the helpers are
# stored in /etc/modules.conf.
IPTABLES_MODULES=""

# Unload modules on restart and stop
#   Value: yes|no,  default: yes
# This option has to be 'yes' to get to a sane state for a firewall
# restart or stop. Only set to 'no' if there are problems unloading netfilter
# modules.
IPTABLES_MODULES_UNLOAD="yes"

# Save current firewall rules on stop.
#   Value: yes|no,  default: no
# Saves all firewall rules to /etc/sysconfig/iptables if firewall gets stopped
# (e.g. on system shutdown).
IPTABLES_SAVE_ON_STOP="no"

# Save current firewall rules on restart.
#   Value: yes|no,  default: no
# Saves all firewall rules to /etc/sysconfig/iptables if firewall gets
# restarted.
IPTABLES_SAVE_ON_RESTART="no"

# Save (and restore) rule and chain counter.
#   Value: yes|no,  default: no
# Save counters for rules and chains to /etc/sysconfig/iptables if
# 'service iptables save' is called or on stop or restart if SAVE_ON_STOP or
# SAVE_ON_RESTART is enabled.
IPTABLES_SAVE_COUNTER="no"

# Numeric status output
#   Value: yes|no,  default: yes
# Print IP addresses and port numbers in numeric format in the status output.
IPTABLES_STATUS_NUMERIC="yes"



i im prety sure its not using nat. but if it is im guessing its going to be shown on the host machine's (i take it that HN was a typo for HM)ifconfig. so here it is:

eth0      Link encap:Ethernet  HWaddr 00:18:F8:0B:2F:52
          inet addr:192.168.0.4  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:85674 errors:0 dropped:0 overruns:0 frame:0
          TX packets:141758 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:19927881 (19.0 MiB)  TX bytes:25754199 (24.5 MiB)
          Interrupt:20 Base address:0xcc00

eth0:1    Link encap:Ethernet  HWaddr 00:18:F8:0B:2F:52
          inet addr:192.168.0.5  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:20 Base address:0xcc00

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:199 errors:0 dropped:0 overruns:0 frame:0
          TX packets:199 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:21462 (20.9 KiB)  TX bytes:21462 (20.9 KiB)

venet0    Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1
          RX packets:94 errors:0 dropped:0 overruns:0 frame:0
          TX packets:132 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:11127 (10.8 KiB)  TX bytes:10582 (10.3 KiB)


as you can see i edited venet0 a bit if its wrong please say and i wll revert it back.

[Updated on: Sun, 03 February 2008 18:26]

Report message to a moderator

Re: cant login to virtual machine from other computers [message #26849 is a reply to message #26848] Sun, 03 February 2008 18:27 Go to previous messageGo to next message
rickb is currently offline  rickb
Messages: 368
Registered: October 2006
Senior Member
probably you need to read the wiki or seek help from a linux admin familiar with nat.

#iptables -L -n -t nat


-------------
Common Terms I post with: http://wiki.openvz.org/Category:Definitions

UBC. Learn it, love it, live it: http://wiki.openvz.org/Proc/user_beancounters
Re: cant login to virtual machine from other computers [message #26852 is a reply to message #26849] Sun, 03 February 2008 19:14 Go to previous messageGo to next message
alex905 is currently offline  alex905
Messages: 8
Registered: February 2008
Location: London
Junior Member
i went through the troble shooting but found nothing. and the computer im tring to ssh with is also on the private network so im pretty sure nat wont come into it.

here is the output from that command

Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
Re: cant login to virtual machine from other computers [message #26853 is a reply to message #26852] Sun, 03 February 2008 23:28 Go to previous messageGo to next message
alex905 is currently offline  alex905
Messages: 8
Registered: February 2008
Location: London
Junior Member
fixed it. i had to add a virtual interface for every ip asined to a VE.

for example:
on my foirst virtual machine i assined it the IP 192.168.0.6 by issuing the command

vzctl set 102 --ipadd 192.168.0.6 --save (this is for the beifit of beginers)
then i edited a network interface created by openVZ

my /etc/sysconfig/network-scripts/ifcfg-venet0 reads
NAME=""
BOOTPROTO=none
DEVICE=venet0
NETMASK=255.255.255.0
MTU=1500
BROADCAST=192.168.0.255
IPADDR=192.168.0.6
NETWORK=192.168.0.0
ONBOOT=yes


then

because i have more then one virtual machine i need more then one IP so i assined another IP to the secound machine using the command above obviosly substituting some commands and values where nesecary. (it was asined 192.168.0.7)


then i has to create a virtual interface for the venet0 interface. to do this i created the file ifcfg-venet0:1

which can be done using this command:

vi /etc/sysconfig/network-scripts/ifcfg-venet0:0

then filled it with this data.

NAME=""
BOOTPROTO=none
DEVICE=venet0:1
NETMASK=255.255.255.0
MTU=1500
BROADCAST=192.168.0.255
ONPARENT=yes
IPADDR=192.168.0.7
NETWORK=192.168.0.0
ONBOOT=yes



if your new to this and as lost as i was i hope this mini tut helps you.

oh andim not a bad speller im just really fooking lazy.

Re: *solved* cant login to virtual machine from other computers [message #26856 is a reply to message #26845] Mon, 04 February 2008 07:23 Go to previous messageGo to next message
maratrus is currently offline  maratrus
Messages: 1495
Registered: August 2007
Location: Moscow
Senior Member
Hi,

Can I ask you a question?
- Is it possible to ping your VPS from remote computers?
Re: *solved* cant login to virtual machine from other computers [message #26858 is a reply to message #26856] Mon, 04 February 2008 07:38 Go to previous messageGo to next message
alex905 is currently offline  alex905
Messages: 8
Registered: February 2008
Location: London
Junior Member
yes. but i find that missleading. it is a start in tring to get them connected but seeing as i was sometimes pinging the host and not the VE i stoped doing that and relyed on SSH.
Re: *solved* cant login to virtual machine from other computers [message #26860 is a reply to message #26858] Mon, 04 February 2008 08:27 Go to previous message
maratrus is currently offline  maratrus
Messages: 1495
Registered: August 2007
Location: Moscow
Senior Member
Hi,

1) When you add an ip address to VE you should not to create the eth0 alias and assign to it the same ip address.

2) When you add an ip address to VE you should not to create the venet0 alias and assign to it the same ip address.

3) I think that 2) is the reason why you ping HN instead of VPS.
4) Please check sysctl parameters http://wiki.openvz.org/Quick_installation#sysctl
5) You can use "tcpdump" to determine the net behavior.
Previous Topic: After Install cpanel, apache, cpanel no work
Next Topic: Possibility of using bridge in VE
Goto Forum:
  


Current Time: Thu Nov 07 06:17:22 GMT 2024

Total time taken to generate the page: 0.03299 seconds