Im new into LINUX and i need your help for my OVH VPS Ubuntu Server 16.04LTS interface actually on DHCP to STATIC
Actually my /etc/network/interfaces file is :
# 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
# Source interfaces
# Please check /etc/network/interfaces.d before changing this file
# as interfaces may have been defined in /etc/network/interfaces.d
# See LP: #1262951
source /etc/network/interfaces.d/*.cfg
The source path /etc/network/interfaces.d/*.cfg have only one file named : 50-cloud-init.cfg and this file contain :
auto lo
iface lo inet loopback
auto ens3
iface ens3 inet dhcp
So my IP address is 149.xxx.xxx.61, I need to transform this to have an iface ens3 static for my IP address.
Actually ifconfig -a is :
ens3 Link encap:Ethernet HWaddr fa:16:3e:ae:e3:83
inet addr:149.xxx.xxx.61 Bcast:149.xxx.xxx.61 Mask:255.255.255.255
inet6 addr: fe80::xxxx:xxxx:feae:e383/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:894526 errors:0 dropped:0 overruns:0 frame:0
TX packets:297070 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:102187906 (102.1 MB) TX bytes:63602471 (63.6 MB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:14743 errors:0 dropped:0 overruns:0 frame:0
TX packets:14743 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:31459525 (31.4 MB) TX bytes:31459525 (31.4 MB)
How can I do this ?
Here is an example file with a guide from one of my servers:
Please note: not all OVH servers have IPv6 support or a routed IPv6 address. You can check this in your control panel and if you do not see an address to use or don't want IPv6 support do not include that section.
To find your link local address required for routing the IPv6 it can be found via the OVH API or by converting the interface's MAC address into an appropriate link-local address.
And of course, if you do not have any failover IP addresses do not include that section.
And last, please note that on some VMware based VMs the gateway's last octet may need to be .254 instead of .1.
auto lo
iface lo inet loopback
#auto ens3
#iface ens3 inet dhcp
#--static IPv4--
auto ens3
iface ens3 inet static
address <main server IP>
netmask 255.255.255.255
broadcast <main server IP>
gateway <main server IP's first three octets>.1
dns-nameservers 8.8.8.8 8.8.4.4
#iface ens3 inet6 dhcp #does not seem to work for OVH VPS 2016 range
#--static IPv6--
iface ens3 inet6 static
address <IPv6 address-should begin with 2001:41d0:>
netmask 128
post-up /sbin/ip -6 route add <IPv6 link local-should begin with fe80::> dev ens3
post-up /sbin/ip -6 route add default via <IPv6 link local-should begin with fe80::> dev ens3
pre-down /sbin/ip -6 route del default via <IPv6 link local-should begin with fe80::> dev ens3
pre-down /sbin/ip -6 route del <IPv6 link local-should begin with fe80::> dev ens3
dns-nameservers 2001:4860:4860::8888 2001:4860:4860::8844
#--failover IP address #1--
auto ens3:0
iface ens3:0 inet static
address <failover IP address #1>
netmask 255.255.255.255
broadcast <failover IP address #1>
#--failover IP address #2--
auto ens3:1
iface ens3:1 inet static
address <failover IP address #2>
netmask 255.255.255.255
broadcast <failover IP address #2>
First, you must find your IP and Gateway for IPv6. They can be found in your OVH manager.
Modify your network config file with this command (use sudo if you are not root) :
nano /etc/network/interfaces.d/50-cloud-init.cfg
Add these lines :
iface eth0 inet6 static
address YOUR_IPV6
netmask IPV6_PREFIX
post-up /sbin/ip -f inet6 route add IPV6_GATEWAY dev eth0
post-up /sbin/ip -f inet6 route add default via IPV6_GATEWAY
pre-down /sbin/ip -f inet6 route del IPV6_GATEWAY dev eth0
pre-down /sbin/ip -f inet6 route del default via IPV6_GATEWAY
YOUR_IPV6 must be replaced with your IPv6.
IPV6_PREFIX must be replaced with 128.
IPV6_GATEWAY must be replaced with your IPv6 gateway.
Reboot your VPS.
Reference : http://docs.ovh.ca/fr/guides-network-ipv6.html#debian-derivatives-ubuntu-crunchbang-steamos
I have an issue with the internet in my VMWare guest machine working very randomly (mostly not working) and I am not sure what the issue might be.
Sometimes the internet works (this also includes possibility to ssh to the host), but most of the time it doesn't.
Restarting networking doesn't help, nor any ifdown/ifup's. The only situation when it might start working is restarting the whole VM. And even then it starts working perhaps one time in 10.
The only potential issue I have noticed so far is that when it doesn't work, VM network adapters' MAC addresses are swapped - while if it works, they are as configured.
Details:
host: OS X El Capitan 10.11.4 running VMWare Fusion 8.0.1
guest: Linux debian 3.2.0-4-amd64 #1 SMP Debian 3.2.65-1+deb7u2 x86_64 GNU/Linux
VMWare virtual machine network settings:
Network Adapter 1 - NAT - static MAC address 00:50:56:38:CC:21
Network Adapter 2 - Host only - static MAC address 00:50:56:38:CC:22
In my virtual machine .vmx configuration file I have this (related to the interfaces):
ethernet0.present = "TRUE"
ethernet0.connectionType = "nat"
ethernet0.wakeOnPcktRcv = "FALSE"
ethernet0.addressType = "static"
ethernet0.linkStatePropagation.enable = "FALSE"
ethernet0.pciSlotNumber = "33"
ethernet0.address = "00:50:56:38:CC:21"
ethernet0.startConnected = "TRUE"
ethernet0.vnet = "vmnet2"
ethernet0.bsdName = "en0"
ethernet0.displayName = "Wi-Fi"
...
ethernet1.present = "TRUE"
ethernet1.connectionType = "hostonly"
ethernet1.virtualDev = "e1000"
ethernet1.wakeOnPcktRcv = "FALSE"
ethernet1.addressType = "static"
ethernet1.linkStatePropagation.enable = "FALSE"
ethernet1.pciSlotNumber = "37"
ethernet1.address = "00:50:56:38:CC:22"
ethernet1.startConnected = "TRUE"
Host ifconfig:
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
options=3<RXCSUM,TXCSUM>
inet6 ::1 prefixlen 128
inet 127.0.0.1 netmask 0xff000000
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
nd6 options=1<PERFORMNUD>
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether a0:99:9b:0b:bf:c5
inet6 fe80::a299:9bff:fe0b:bfc5%en0 prefixlen 64 scopeid 0x4
inet 10.230.82.42 netmask 0xffffc000 broadcast 10.230.127.255
nd6 options=1<PERFORMNUD>
media: autoselect
status: active
en1: flags=963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX> mtu 1500
options=60<TSO4,TSO6>
ether 6a:00:01:ba:d6:30
media: autoselect <full-duplex>
status: inactive
en2: flags=963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX> mtu 1500
options=60<TSO4,TSO6>
ether 6a:00:01:ba:d6:31
media: autoselect <full-duplex>
status: inactive
bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=63<RXCSUM,TXCSUM,TSO4,TSO6>
ether a2:99:9b:b0:3e:00
Configuration:
id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
ipfilter disabled flags 0x2
member: en1 flags=3<LEARNING,DISCOVER>
ifmaxaddr 0 port 5 priority 0 path cost 0
member: en2 flags=3<LEARNING,DISCOVER>
ifmaxaddr 0 port 6 priority 0 path cost 0
nd6 options=1<PERFORMNUD>
media: <unknown type>
status: inactive
p2p0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 2304
ether 02:99:9b:0b:bf:c5
media: autoselect
status: inactive
awdl0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1484
ether 7a:81:75:a1:0f:87
inet6 fe80::7881:75ff:fea1:f87%awdl0 prefixlen 64 scopeid 0x9
nd6 options=1<PERFORMNUD>
media: autoselect
status: active
vmnet1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether 00:50:56:c0:00:01
inet 192.168.247.1 netmask 0xffffff00 broadcast 192.168.247.255
vmnet8: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether 00:50:56:c0:00:08
inet 192.168.195.1 netmask 0xffffff00 broadcast 192.168.195.255
Guest /etc/network/interfaces:
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.195.200
netmask 255.255.255.0
gateway 192.168.195.2
auto eth1
iface eth1 inet static
address 192.168.247.200
netmask 255.255.255.0
Guest ifconfig (when internet works):
eth0 Link encap:Ethernet HWaddr 00:50:56:38:cc:21
inet addr:192.168.195.200 Bcast:192.168.195.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fe38:cc21/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:470 errors:0 dropped:0 overruns:0 frame:0
TX packets:461 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:74106 (72.3 KiB) TX bytes:53650 (52.3 KiB)
Interrupt:19 Base address:0x2000
eth1 Link encap:Ethernet HWaddr 00:50:56:38:cc:22
inet addr:172.16.121.132 Bcast:172.16.121.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fe38:cc22/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1648 (1.6 KiB) TX bytes:578 (578.0 B)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:61 errors:0 dropped:0 overruns:0 frame:0
TX packets:61 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:24465 (23.8 KiB) TX bytes:24465 (23.8 KiB)
Guest ifconfig (when internet doesn't work):
eth0 Link encap:Ethernet HWaddr 00:50:56:38:cc:22
inet addr:192.168.195.200 Bcast:192.168.195.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fe38:cc22/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:12 errors:0 dropped:0 overruns:0 frame:0
TX packets:217 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2472 (2.4 KiB) TX bytes:9398 (9.1 KiB)
eth1 Link encap:Ethernet HWaddr 00:50:56:38:cc:21
inet addr:192.168.247.200 Bcast:192.168.247.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fe38:cc21/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:26 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3498 (3.4 KiB) TX bytes:620 (620.0 B)
Interrupt:19 Base address:0x2000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:219 errors:0 dropped:0 overruns:0 frame:0
TX packets:219 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:42755 (41.7 KiB) TX bytes:42755 (41.7 KiB)
Here I can see the only difference - the MAC addresses are the other way round, compared to how they are configured.
When internet works:
from the guest, pinging all 192.168.195.* works fine (.200, .2 and .1)
from the host, I can ping myself (.1) and the guest (.200), pinging .2 gives me 'Request timeout' error
When it doesn't work:
from the guest I can ping myself (192.168.195.200), but pinging any other 192.168.195.* (.2 or .1) gives me 'Destinaton Host Unreachable' error. Same when pinging the internet (for example 8.8.4.4)
from the host I can ping myself (192.168.195.1), but pinging any other 192.168.195.* (.2 or .200) gives me 'Request timeout' error.
Any idea why this might be happening, and what else I could try?
Thanks!
The issue is solved now.
I tried the workaround described at https://communities.vmware.com/message/2350978#2350978 - generally creating a new VM using the existing VMDK virtual disk (which re-created all the external VM settings) - it worked flawlessly, even though being a little overkill.
Just in case I have kept the copy of the original problematic VM, and then, after getting help from the VMWare employee - which suggested removing the NAT adapter settings (all ethernet0. entries) from the VM's .vmx configuration file, then removing the network adapter itself, and then re-adding it - everything started working perfectly.
Guess I just had some old settings in the .vmx file, from previous versions of VMWare, or old VM configurations...
I want to run an ad-hoc wireless on two lop tops that both of them have Linux OS. I use this for creating ad-hoc network.(I have stopped Network Manager before it)
sudo ifconfig wlan0 down
sudo iwconfig wlan0 mode ad-hoc essid test-adhoc channel 3
sudo ifconfig wlan0 up
sudo ifconfig wlan0 192.168.1.1 netmask 255.255.255.0
My ifconfig:
ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:25388 errors:0 dropped:0 overruns:0 frame:0
TX packets:25388 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3916018 (3.9 MB) TX bytes:3916018 (3.9 MB)
vmnet1 Link encap:Ethernet HWaddr 00:50:56:c0:00:01
inet addr:192.168.237.1 Bcast:192.168.237.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fec0:1/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:505 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
vmnet8 Link encap:Ethernet HWaddr 00:50:56:c0:00:08
inet addr:172.16.62.1 Bcast:172.16.62.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fec0:8/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:504 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
wlan0 Link encap:Ethernet HWaddr ac:72:89:1b:19:76
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::ae72:89ff:fe1b:1976/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1543085 errors:0 dropped:27 overruns:0 frame:0
TX packets:19353 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:183406489 (183.4 MB) TX bytes:3741745 (3.7 MB)
And iwconfig
vmnet8 no wireless extensions.
eth0 no wireless extensions.
lo no wireless extensions.
wlan0 IEEE 802.11bgn ESSID:"test-adhoc"
Mode:Ad-Hoc Frequency:2.422 GHz Cell: A2:A3:E3:9B:6A:FA
Tx-Power=15 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Power Management:off
vmnet1 no wireless extensions.
IP for first Lop top is <192.168.1.1> and for second one is <192.168.1.2>. I checked the route:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
172.16.62.0 * 255.255.255.0 U 0 0 0 vmnet8
192.168.1.0 * 255.255.255.0 U 0 0 0 wlan0
192.168.237.0 * 255.255.255.0 U 0 0 0 vmnet1
But when i ping one from other:
ping 192.168.1.2
PING 192.168.1.2 (192.168.1.2) 56(84) bytes of data.
From 192.168.1.1 icmp_seq=1 Destination Host Unreachable
From 192.168.1.1 icmp_seq=2 Destination Host Unreachable
From 192.168.1.1 icmp_seq=3 Destination Host Unreachable
From 192.168.1.1 icmp_seq=4 Destination Host Unreachable
From 192.168.1.1 icmp_seq=5 Destination Host Unreachable
From 192.168.1.1 icmp_seq=6 Destination Host Unreachable
what should i do? My system is Ubuntu 14.04.
I just change my approach. In this tutorial the second method is not working.
In the first method just don't use the "auto wlan0". (If you do you will connect to another network, possibly)
I've configured my Raspberry Pi for static IP. My /etc/network/interfaces looks like this:
auto lo
iface lo inet loopback
auto eth0
allow-hotplug eth0
iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
Yet for some strange reason, every time I reboot my Pi or my router, my Pi gets the requested IP (192.168.1.2) but ALSO a DHCP address (192.168.1.18). So my Pi has two addresses.
Of course, this isn't necessarily a problem, I just think it's strange. Am I doing something wrong? Or not enough? My router is almost completely locked down for management, but I can enter static IPs for devices - is this necessary, if I configure the Pi to do it?
The dynamic address isn't apparent in ifconfig:
eth0 Link encap:Ethernet HWaddr b8:27:eb:5d:87:71
inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:236957 errors:0 dropped:34 overruns:0 frame:0
TX packets:260738 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:35215632 (33.5 MiB) TX bytes:70023369 (66.7 MiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:27258 errors:0 dropped:0 overruns:0 frame:0
TX packets:27258 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3397312 (3.2 MiB) TX bytes:3397312 (3.2 MiB)
yet I can ping, ssh and everything on .18 as well.
Since you can add multiple IP addresses to the interface eth0 as noted above, I believe the solution to your problem is to remove the auto eth0 line from your /etc/network/interfaces file.
The IP address attached to interface eth0 can be viewed by ip addr. May be eth0 has two IP address configured 192.168.1.2 and 192.168.1.18.
Also you can add multiple IP address to interface eth0 through
sudo ip addr add <IP address> dev eth0
If you dont want IP address 192.168.1.18 you can remove it by
sudo ip addr del 192.168.1.18 dev eth0
I have a arm platform with gigabit ethernet that I would like to connect to my ubuntu machine
to test the ethernet ports.
Networking is not my strong suit.
I've modified /etc/network/interfaces on the embedded system thusly:
# Configure Loopback
auto lo
iface lo inet loopback
#auto eth0
#iface eth0 inet dhcp
auto eth0
iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
gateway 192.168.1.0
And on my ubuntu machine I have set (through the network connections window):
IP: 192.168.1.1
netmask: 255.255.255.0
gateway: 192.168.1.0
When I test the connection, no connection is recognized on the arm system.
The eth0 port produces this output:
eth0: link up, 10 Mb/s, half duplex, flow control disabled
ip: RTNETLINK answers: Invalid argument
ifconfig displays:
# ifconfig
eth0 Link encap:Ethernet HWaddr 02:50:43:C5:C5:75
inet addr:192.168.1.2 Bcast:0.0.0.0 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:11
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:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Can anyone point out my most likely obvious mistake?
Let me know if I need to provide more information.
EDIT: I'm running busybox 1.18.5 on the embedded system.
EDIT 2:
# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
This is bad
auto eth0
iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
gateway 192.168.1.0
192.168.1.0 is your network address. For sure it cannot be your gateway. Usually you have configuration like this
auto eth0
iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
gateway 192.168.1.1
network 192.168.1.0
broadcast 192.168.1.255
where the latter two can automatically be calculated from the address and the netmask and are therefore not written in the config file