Linux IP adress cannot be accessed via ssh command - linux

In my Linux server I have 2 interfaces so the linux server can be accessed via Terminal by typing
ssh username#IP1
or ssh username#IP2
Every thing works fine until I restarted my server. Now I could only access the linux server via the first IP address.
I checked IP configuration (here I am connected to the server via my first IP address)nano etc/network/interfacesgives:
iface eth0 inet static
address 192.168.1.13
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.253
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 192.168.1.2
# The secondary network interface
allow-hotplug eth1
iface eth1 inet static
address 192.168.1.14
netmask 255.255.255.255
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.253
dns-nameservers 192.168.2.2
ifconfig shows that only eth0 is up so, so once I typed nano /sys/class/net/eth1/operstateI discovered that this interface(second IP adress) is down so I tried ifconfig eth1 192.168.1.14 netmask 255.255.255.255 up and then restarted my networking service and ifconfig shows that my interface is up and can be accessed via terminal, but my access is denied (Permission denied, please try again) once I tried ssh username#192.168.1.14what can I
do in order to be able to access the servers via terminal with this IP address

Try to ping the second interface just to make sure there isn't something wrong with the network itself
Make sure that SSH Daemon is configured to listen on both ports.

i'm pretty sure that the problem is in this line:
allow-hotplug eth1
change it to auto eth1, the interface should now start whenever the system starts.

Related

How to connect the host to her virtual bridge?

A bridge brOnline is connected to eth0 which provides access to the LAN / Internet. The setup is archived within modifying /etc/network/interfaces like below.
Why? The aim of this adventure is establish a virtual network between several virtual machines and the system hosting the virtual bridge an the virtual machines (host).
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
auto MyBridge
iface MyBridge inet dhcp
bridge_port eth0
bridge_stp on
bridge_fd 0.0
How can I connect to the bridge from my host?
One important thing: Adding eth0 to the bridge makes it somehow unavailable to the host!
So before adding the interface eth0 to the bridge, which magic was connected to eth0 which enabled my browser the access to the local network? Can or how can I connect this magic to the bridge to have access to the LAN and can talk to the other clients connected to the bridge?
The attempts have been wrong. For the host it is not necessary to connect over an tap-device to the bridge, it has the abilety to connect directly to the bridge. In Other words if you set your default route to bridge connecting to the gateway, than you can connect to the LAN-Interface too.
# see actual settings
# The displayed via is the default gw which may be provided by your dhcp
ip route
default via 42.69.42.69 dev eth0
...
# delete the default route, otherwise error: "file exists" will show up
sudo ip route del default via 42.69.42.69 dev eth0
# Add your bridge as default route
sudo ip route add default via 42.69.42.69 dev brOnline
# check
ip route
default via 10.13.0.10 dev brOnline
ping/ssh to the outside are possible, also firefox is working with those settings.
Hint:
Those changes are not permanent. To do so, you need to edit /etc/network/interfaces.
I'm still not able to ping to the other VM's and vice versa, but this might be an other topic.

Debian guest on VirtualBox with bridged adapter has no internet access

I have setup a Debian guest and I am messing around with it to learn more about VirtualBox, Debian, and later after that is done I'll be messing around with a NodeJS server on it.
After a while I noticed I couldn't do some things with it when I had a Bridged adapter setup for the VM. NPM would not install packages because it timed out. I tried running "w3m google.com" and even looked up google.com's ip to check for a DNS issue.
No matter what, I cannot connect to any form of internet. But I can ping anything just fine. I can ping google, npmjs.org, etc.
Thanks for the assistance.
Update: I have been working on this more today, Newer router, asus, I read that people were having issues with belkin routers with bridged adapters so I switched, the asus is new anyways.
The host is connected via ethernet wire.
The VM shows up on the router just fine, And I connect to that device with the IP given by the router just fine. but I still cannot connect to google.com or anything.
This is too long to explain in a comment. Below is how the bridged adapter works.
Yet, if you can ping from the guest debian that means some form of DHCP happened and you must have and IP (which is a different IP from the host machine). I'd check router configuration to see if you're not allowing/disallowing specific MACs and/or IPs from the usage of TCP/UDP protocols (that is a measure some people use on their routers).
Bridged adapter
A bridged adapter on VirtualBox simulates as if there was a bridge (well it is easier to think of this as a hub) on the cable connection to your (host) actual machine. Even if the connection is over wireless the simulation is similar.
For (almost) all purposes the guest (debian) and the router the host machine is connected to are connected directly. Have separate MAC, separate IP, they even give separate ARP requests.
router <---> host machine running VirtualBox
^
|
+-----> guest machine running Debian
This is done by sending packets with a different hardware address (you can configure the hardware address in the adapter).
You need to configure the guest system (Debian) to connect to the network as if it was a separate machine. For example, if you use a WPA connection from the host machine you need to configure WPA (including the username and password) in the guest machine.
I am not an expert, but after some research I could solve a similar problem. I have a Mac hosting a Debian server. I used Bridged Adapter on interface en0 in my Mac.
1) My Mac is running on 192.168.10.101. I know that because I run the command:
ifconfig -a
and the interface en0 shows that IP
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether 6c:40:08:98:72:4c
inet6 fe80::6e40:8ff:fe98:724c%en0 prefixlen 64 scopeid 0x4
inet 192.168.10.101 netmask 0xffffff00 broadcast 192.168.10.255
2) Running netstat command at my Mac:
netstat -nr
Internet:
Destination Gateway Flags Refs Use Netif Expire
default 192.168.10.1 UGSc 296 142 en0
I see that the Mac Gateway is on 192.168.10.1
3) Mac and Debian must be in the same segment as the Gateway, I mean 192.168.10.xxx. So I decided that my Debian must run on the static IP 192.168.10.115.
I edited /etc/network/interfaces file at my Debian server to look this way:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug eth0
iface eth0 inet static
address 192.168.10.115
netmask 255.255.255.0
gateway 192.168.10.1
dns-nameservers 8.8.8.8 192.168.10.1
Then I did ping from my Mac and ping from my Debian and they answered Ok. I also have access to internet from Debian, because I have the same Default Gateway as my Mac.
root#debian64:/home/myuser# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default TEW-711BR 0.0.0.0 UG 0 0 0 eth0
link-local * 255.255.0.0 U 1000 0 0 eth0
I hope it helps and if anybody have better explanations I would like to learn.

Can't change IP to static on debian beaglebone

I'm currently working with a beaglebone black and want to evade the whole dhcp issue. I'm trying to change my IP to remain static; however, after I've done all of that and inputted my dns (since resolvconf is installed), it still won't change the IP even though i've restarted the networks and the entire beaglebone. It also seems like even when I mess with the code in /etc/network/interfaces by changing the usb's IP, placing fubar etc -- that updating the network doesn't affect the ifconfig. I'm thinking that the network is grabbing these address from somewhere else and I'm not sure how to find that. Below is my code in /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
#allow-hotplug eth0
#iface eth0 inet dhcp
# Example to keep MAC address between reboots
#hwaddress ether DE:AD:BE:EF:CA:FE
# The secondary network interface
#allow-hotplug eth1
#iface eth1 inet dhcp
# WiFi Example
#auto wlan0
#iface wlan0 inet static
# wpa-ssid "essid"
# wpa-psk "TMS"
# Ethernet/RNDIS gadget (g_ether)
# ... or on host side, usbnet and random hwaddr
# Note on some boards, usb0 is automaticly setup with an init script
auto eth0
allow-hotplug eth0
iface eth0 inet static
address 10.31.49.168
netmask 255.255.252.0
gateway 10.31.49.253
dns-domain tms.local
dns-nameserver 10.31.49.6
iface usb0 inet static
address 192.168.7.2
netmask 255.255.255.0
network 192.168.7.0
gateway 192.168.7.1
dns-nameservers 10.31.49.6
dns-search lan
Please let me know what I can do. Thank you in advance!
I don't know if this will answer your question, but, the BBB debian distribution uses connman to manage the network.
I've also not been able to get a static IP address to work, but maybe this will help in your research.

private and public ipaddress on azure cloud

I'm trying to run gwan on an Azure cloud machine. But I get issues with network interfaces, or I simply cannot hit the machine with the browser.
I believe the issue has to do with internal IP address assigned by the Azure router, but also I could be missing some critical security issue (or something else)
The machine is running CentOS.
Here is my configuration:
/etc/sysconfig/iptables-config
added a rule for accepting traffic via port 80
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
/etc/hosts
added the public IP address and mapped that to a subdomain of cloudapp.net
192.12.45.23 myappname.cloudapp.net
gwan_linux64-bit
changed the directories to suit the public IP.
mv 0.0.0.0_8080/#0.0.0.0
192.12.45.23_80/#192.12.45.23
run gwan
sudo ./gwan
can't listen on 168.62.8.160:80 (Cannot assign requested address)
Available network interfaces (2):
127.0.0.1 12.109.24.35
Then I tried both 12.109.24.35 and 127.0.0.1 interfaces -
gwan ran without an error, but I couldn't browse the machine using the public IP of 168.62.8.160:80
further info:
/etc/sysconfig/network doesnt use the FQDN myappname.cloudapp.net but
HOSTNAME=myappname
NETWORKING=yes
as well, /etc/sysconfig/network-scripts/ifcfg-eth0
DHCP_HOSTNAME=myappname
DEVICE=eth0
I don't know Azure and its specificities. But it seems that you are missing a system configuration for your IP address (a problem that has little to do with G-WAN).
Your error is:
"can't listen on 168.62.8.160:80
Available network interfaces (2): 127.0.0.1 12.109.24.35"
On a Linux machine you would have to assign the 168.62.8.160 IP address to one of your network adapters in order for the system to be able to use it.
For temporary changes: ifconfig eth0:1 168.62.8.160
For permanent changes:
vim /etc/network/interfaces
--------------------------------------------------------------
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 12.109.24.35
network ... // replace ... by the relevant data
netmask ... // replace ... by the relevant data
auto eth0:1
iface eth0:1 inet static
address 168.62.8.160
network ... // replace ... by the relevant data
netmask ... // replace ... by the relevant data
--------------------------------------------------------------
...and then run: /etc/init.d/networking restart
That's what would work if you were running Linux, just in case that may help to understand what you are missing on Microsoft Azure.

Specifying source IP address for a host route

I am using Ubuntu 12.04. I assigned two IP addresses to the ethernet card by editing /etc/network/interfaces. It now looks like that (skipping lines not related to the question).
auto eth0
iface eth0 inet static
address 192.168.60.23
netmask 255.255.255.0
gateway 192.168.60.1
up route add 192.168.60.1 dev eth0
up route add 10.0.1.1 dev eth0
up route add 192.168.60.151 gw 10.0.1.1
auto eth0:1
iface eth0:1 inet static
address 192.168.60.101
netmask 255.255.255.0
Now, howerver, I would like to let the packets going to 192.168.60.151 leave my machine with the second IP address (192.168.60.101) as source address.
I tried adding src 192.168.60.101 to the corresponding up route line but it didn't work. I also tried to move this line to the eth0:1 block but it didn't work either. When I execute ip route get 192.168.60.151 I always get 192.168.60.151 via 10.0.1.1 dev eth0 src 192.168.60.21.
I googled but didn't find out how to modify the source address of outgoing packets.

Resources