how add static link 0.0.0.0 and in which file for persistence

Issues related to configuring your network
Post Reply
SM0EPM
Posts: 12
Joined: 2015/08/16 10:04:47

how add static link 0.0.0.0 and in which file for persistence

Post by SM0EPM » 2017/10/24 15:20:56

Hi all,
I have a problem configuring routes.
Here's some background:
My centos server is connected to a WiFi AP. I can easily connect my WiFi rigs like TV, cellphones and windows' laptops etc to both LAN in the server and WLAN. The server (rubus 192.168.1.15) is centos 7 64 bit.

I am now trying to set up a bit older laptop in order to prolong its life. I have managed to install centos 6.9 32-bit. No problem to connect with ethernet cable (eth0) to server WAN and LAN. The laptop WiFi connectivity is my problem. The connection is 'wlan0'. Wlan-subnet is 10.52.75.0 and the laptop is dhcp-served by the server rubus. I can manage to achive this routing table by adding rubus' net to the route-for-the-vlan file:

Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.52.75.0 * 255.255.255.0 U 2 0 0 wlan0
192.168.1.0 10.52.75.1 255.255.255.0 UG 0 0 0 wlan0

This gives me access to rubus' LAN but not to the WAN. I can fix that by manually adding this rule in the terminal:
route add -net 0.0.0.0 gw 10.52.75.1

And this is the routing table afterwards:

Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.52.75.0 * 255.255.255.0 U 2 0 0 wlan0
192.168.1.0 10.52.75.1 255.255.255.0 UG 0 0 0 wlan0
default 10.52.75.1 0.0.0.0 UG 0 0 0 wlan0


I have really tried to put in this rule in different config files like route-for-the-vlan and ifcfg-for-the-vlan in network-scripts dir. With no sucsess, there will always be a cofig error when restarting network.

Here is the ifcfg-file:

ESSID="SM0EPM/W_2dot4_GHz"
MODE=Managed
KEY_MGMT=WPA-PSK
TYPE=Wireless
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="Auto SM0EPM/W_2dot4_GHz"
UUID=6c4c0d61-e8d2-4941-8896-f75ba92c980c
ONBOOT=yes
CIPHER_GROUP="TKIP CCMP"
PEERDNS=yes
PEERROUTES=yes

Here is the route-file:
192.168.1.0/24 via 10.52.75.1 metric 0

How and where can I add the '0.0.0.0' net to be persistent over rebootings?
Regards,
Ebbe

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: how add static link 0.0.0.0 and in which file for persistence

Post by TrevorH » 2017/10/24 15:38:29

Are you sure you don't just need to add GATEWAY= to your ifcfg file?
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

SM0EPM
Posts: 12
Joined: 2015/08/16 10:04:47

Re: how add static link 0.0.0.0 and in which file for persistence

Post by SM0EPM » 2017/10/24 15:59:55

I just tried to put in GATEWAY=10.52.75.1 in the ifcfg-file and it did not work.
routing table without the 0.0.0.0 net to give access to rubus-server's WAN
Ebbe

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: how add static link 0.0.0.0 and in which file for persistence

Post by jlehtone » 2017/10/31 08:08:04

SM0EPM wrote:Here's some background:
My centos server is connected to a WiFi AP. I can easily connect my WiFi rigs like TV, cellphones and windows' laptops etc to both LAN in the server and WLAN. The server (rubus 192.168.1.15) is centos 7 64 bit.

I am now trying to set up a bit older laptop in order to prolong its life. I have managed to install centos 6.9 32-bit. No problem to connect with ethernet cable (eth0) to server WAN and LAN. The laptop WiFi connectivity is my problem. The connection is 'wlan0'. Wlan-subnet is 10.52.75.0 and the laptop is dhcp-served by the server rubus.
I cannot follow.

You mention subnets "LAN", "WAN" and "WLAN".
You mention a subnet that includes 192.168.1.15.
You mention that subnet "WLAN" is 10.52.75.0/? and that "rubus" is its DHCP-server.

Who is 10.52.75.1?
If rubus is member of more than one subnet, then it should have addresses on all of them.

SM0EPM
Posts: 12
Joined: 2015/08/16 10:04:47

Re: how add static link 0.0.0.0 and in which file for persistence

Post by SM0EPM » 2017/10/31 09:38:54

Hi jlehtone and tnx for taking your time.
Sorry for the mess about networking info.
Here some more, hopefully to clearify:
rubus is the main server with 3 NIC cards:
enp1s0 connets to the WiFi access point box with subnet 10.52.75.0 (I call it local radionetwork)
enp5s0 connects to internal ethernet cable subnet 192.168.1.0 (LAN Local area network)
enp6s0 connects to external internet ISP on 82.xxx.xxx.xxx static IP address (WLAN wide area network)

salmo is the PC I am trying to connect.
It has 2 connection possibilities:
eth0 that can be cable connected to rubus' 192.168.1.0 network (LAN) : works with no problems
wlan0 that is to be connected to the WiFi AP box on the 10.52.75.0 network : I am not able to create a route in salmo by using the network tools in the system. I can add a route manually in the terminal "route add -net 0.0.0.0 gw 10.52.75.1" and the connection is established. But it is of course gone after reboot.

The AP-box itself has the address 10.52.75.1
rubus DHCP server serves both radionetwork and LAN with addresses.

So my problem is how to create a route that will not disappear after reboot. Network Manager is also rewriting things when it thinks it is needed.
WIN PC:s and other devices can connect to the WiFI network with no problems.

Regards

Ebbe

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: how add static link 0.0.0.0 and in which file for persistence

Post by jlehtone » 2017/10/31 13:54:31

SM0EPM wrote: rubus:
enp1s0 connets to the WiFi access point box with subnet 10.52.75.0 (I call it local radionetwork)

The AP-box itself has the address 10.52.75.1
rubus DHCP server serves both radionetwork and LAN with addresses.
If rubus is member of radionetwork, then it must have an IP address in the radionetwork.

The IP address of the AP-box is insignificant. You should use it only for admin access to the AP-box.
The AP-box is simply a managed network switch, where you hook up both rubus (with wire) and salmo (wireless).

rubus and salmo are both members of the radionetwork. They should see each others broadcasts.
If they don't, then rubus could not serve DHCP for salmo.

Q: Which member of the radionetwork is a router to other networks?
A: rubus

Q: What is thus the "default gateway IP" for members of radionetwork?
A: The 10.52.x.y IP address of rubus

Q: What is the "default gateway IP" given by rubus DHCP for dhclients on the radionetwork?



PS. A "10.52.75.0" does not tell enough about a subnet. Prefix (or netmask) is part of subnet definition too. Address of a machine and prefix are enough to compute subnet and broadcast addresses, and the netmask.

SM0EPM
Posts: 12
Joined: 2015/08/16 10:04:47

Re: how add static link 0.0.0.0 and in which file for persistence

Post by SM0EPM » 2017/10/31 16:03:32

Tnx for answer. Are these configs of sufficient for connections or what do think should be altered?
The just invented workaround was to give salmo a fixed address on the radionetwork. And it worked. But that was just an emergency action
that I want to skip once I can find out how to make use oh the dhcp-service. I have copied the config files of rubus:
Regards Ebbe
==================
[ebbe@rubus ~]$ ifconfig
enp1s0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 10.52.75.1 netmask 255.255.255.0 broadcast 10.52.75.255
ether 64:66:b3:04:4e:24 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

enp5s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.15 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::1101:ec59:34b0:a589 prefixlen 64 scopeid 0x20<link>
ether 38:d5:47:02:ac:cb txqueuelen 1000 (Ethernet)
RX packets 42991 bytes 4941135 (4.7 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 55248 bytes 64676331 (61.6 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device memory 0xdf100000-df17ffff

enp6s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 82.xxx.xxx.xxx netmask 255.255.255.0 broadcast 82.yyy.yyy.yyy
inet6 fe80::3ad5:47ff:fe02:accc prefixlen 64 scopeid 0x20<link>
ether 38:d5:47:02:ac:cc txqueuelen 1000 (Ethernet)
RX packets 74297 bytes 81698591 (77.9 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 59464 bytes 6640407 (6.3 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device memory 0xdf000000-df07ffff

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 1947 bytes 1819757 (1.7 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1947 bytes 1819757 (1.7 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
====================
Part of the /etc/hosts file
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.1 salmo salmo.kvist salmo
.......several more PCs here
192.168.1.15 rubus rubus.kvist rubus
10.52.75.202 SM0EPM-Wlan SM0EPM-Wlan.kvist SM0EPM-Wlan
10.52.75.110 blueray.kvist blueray
======================

[ebbe@rubus ~]$ route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default gateway 0.0.0.0 UG 100 0 0 enp6s0
10.52.75.0 0.0.0.0 255.255.255.0 U 100 0 0 enp1s0
82.182.130.0 0.0.0.0 255.255.255.0 U 100 0 0 enp6s0
192.168.1.0 0.0.0.0 255.255.255.0 U 100 0 0 enp5s0
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
=======================
The dhcpd.conf file:

[root@rubus dhcp]# more dhcpd.conf
ddns-updates off;
option T150 code 150 = string;
one-lease-per-client false;
allow bootp;
#
# DHCP Server Configuration file.
log-facility syslog;
ddns-update-style none;
ignore client-updates;
lease-file-name "var/lib/dhcpd/dhcpd.leases";
authoritative;
option domain-name "kvist";
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.201 192.168.1.220;
default-lease-time 86400;
max-lease-time 86400;
option routers 192.168.1.15;
option ip-forwarding off;
option broadcast-address 192.168.1.255;
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.1.15;
option nntp-server 192.168.1.15;
# option netbios-name-servers 192.168.1.100;

# host laser-printer {
# hardware ethernet 08:00:2b:4c:59:23;
# fixed-address 192.168.1.222;
# }
host ebbepc2 {
hardware ethernet 00:0C:6E:4E:A9:83;
fixed-address 192.168.1.5;
}
host liisapc2 {
hardware ethernet 00:C0:9F:52:53:22;
fixed-address 192.168.1.8;
}
host rubus {
hardware ethernet 38:d5:47:02:ac:cc;
fixed-address 192.168.1.15;
}
#host salmo {
# hardware ethernet 00:23:54:52:D9:7A;
# fixed-address 192.168.1.1;
# }
}
subnet 10.52.75.0 netmask 255.255.255.0 {
range 10.52.75.63 10.52.75.75;
default-lease-time 86400;
max-lease-time 86400;
option routers 10.52.75.1, 192.168.1.15;
# option ip-forwarding off;
option ip-forwarding on;
option broadcast-address 10.52.75.255;
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.1.1, 192.168.1.15, 81.26.227.3;
option nntp-server 192.168.1.15;
#
# AC box admin address
host SM0EPM-Wlan {
hardware ethernet F8:E9:03:DA:57:3F;
fixed-address 10.52.75.202;
}
# DVDB player address
host blueray {
hardware ethernet 90:f1:aa:f1:8a:51;
fixed-address 10.52.75.110;
}
# workaround for salmo connections
host salmo{
hardware ethernet 00:22:43:1E:0E:D6;
fixed-address 10.52.75.120;
}
}

#
# List an unused interface here
#
#subnet 192.168.2.0 netmask 255.255.255.0 {
#}
=========================
DNS file:
;
; Zone file for malus.kvist
;
; The full zone file
;
$TTL 3D
@ IN SOA rubus.kvist. root.rubus.kvist. (
201704011 ; serial, todays date + todays serial #
8H ; refresh, seconds
2H ; retry, seconds
4W ; expire, seconds
1D ) ; minimum, seconds
;
NS rubus ; Inet Address of name server
MX 10 mail ; Primary Mail Exchanger
;
localhost A 127.0.0.1
esox A 192.168.1.9
; MX 10 mail
mail A 192.168.1.15
salmo A 192.168.1.1
...... several PCs here
http://www.rubus A 192.168.1.15
SM0EPM-Wlan A 10.52.75.202
blueray A 10.52.75.110
http://www.rubus.kvist A 192.168.1.15
===============================
[root@rubus named]# more 1.168.192.in-addr.arpa.zone
$TTL 86400
@ IN SOA rubus.kvist. root.rubus.kvist. (
7 ; serial
28800 ; refresh
7200 ; retry
604800 ; expire
86400) ; ttk
NS rubus.kvist.
1 PTR salmo.kvist.
..... several PCs here
10 PTR smelek1.kvist.
15 PTR rubus.kvist.
================================

[root@rubus named]# more 75.52.10.in-addr.arpa.zone
$TTL 86400
@ IN SOA rubus.kvist. root.rubus.kvist. (
7 ; serial
28800 ; refresh
7200 ; retry
604800 ; expire
86400) ; ttk
NS rubus.kvist.
110 PTR blueray.kvist.
202 PTR SM0EPM-Wlan.kvist.

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: how add static link 0.0.0.0 and in which file for persistence

Post by jlehtone » 2017/11/01 11:52:53

SM0EPM wrote:$ ifconfig
enp1s0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 10.52.75.1 netmask 255.255.255.0 broadcast 10.52.75.255


subnet 10.52.75.0 netmask 255.255.255.0 {
range 10.52.75.63 10.52.75.75;
default-lease-time 86400;
max-lease-time 86400;
option routers 10.52.75.1, 192.168.1.15;

# AC box admin address
host SM0EPM-Wlan {
fixed-address 10.52.75.202;
}
Conflicting information. You wrote earlier that AP-box is 10.52.75.1 but do now shaw that it is 10.52.75.202.


Why two routers? The 192.168.1.15 is not on 10.52.75.0/24. Only 10.52.75.1 is.
Remove 192.168.1.15 from the option.

My guess at this point is that other wireless clients pick 10.52.75.1 from "10.52.75.1, 192.168.1.15"
while the CentOS balks at garbage and is left with no gateway.



PS. try out commands (after reading man ip):

Code: Select all

ip -4 ad
ip ro

Post Reply