PXE dhcp route issue - centos

I have PXE running on Centos 6.x. I am trying to image a server with 4 nics. eth0, eth1, eth2, eth3.
eth0 and eth1 are on the network segment that the pxe server is on. I also using this pxe server to serve up files required for the build process via a webserver.
When DHCP hands out an IP address, it does so for all the interfaces, eth0 eth1 eth2 and eth3. It also hands out a default gateway. The default gateway gets configured on eth3. This is wrong as eth3 is not connected to the network where the web server is and it cannot pull down it's files from the webserver.
the address range I am using in PXE is 192.168.20.0/24 gw 192.168.20.1. How can I get PXE DHCP to set the default gateway 192.168.20.1 on eth0 and not eth3
here is the route table
Destination Gateway Genmask Flags Metric Ref Use IFace
192.168.20.0 * 255.255.255.0 U 0 0 0 eth3
192.168.20.0 * 255.255.255.0 U 0 0 0 eth2
192.168.20.0 * 255.255.255.0 U 0 0 0 eth1
192.168.20.0 * 255.255.255.0 U 0 0 0 eth0
127.0.0.1 * 255.255.255.0 U 0 0 0 lo
default 192.168.20.1 0.0.0.0 UG 0 0 0 eth3
here is my dhcp config
ddns-update-style interim;
not authoritative;
option domain-name "mydomain.com";
option domain-name-servers 192.168.20.15;
option subnet-mask 255.255.255.0;
subnet 192.168.20.0 netmask 255.255.255.0 {
authoritative;
range 192.168.20.220 192.168.20.245;
option routers 192.168.20.1;
default-lease-time 900;
max-lease-time 1200000000;
allow unknown-clients;
allow booting;
allow bootp;
next-server 192.168.20.15;
filename "pxelinux.0";
}
Any ideas how I get the default gateway to be on eth0 so I can route properly?
Thanks - Oli

You said on question:
server with 4 nics. eth0, eth1, eth2, eth3. ...
eth0 and eth1 are on the network segment that the pxe server is on. ...
then on the answer:
another DHCP server that was issuing DHCP leases on the network that eth2 and eth3
So basically both segments DHCP servers provide same GW IP. It means that all your NIC's are on the same IP subnet 192.168.20.0/24.
Change your subnet setup.

I had another DHCP server that was issuing DHCP leases on the network that eth2 and eth3 was connected to. This interfered with the routes and caused eth0 and eth1 routing problems. I stopped the DHCP service on the network eth 2 and eth3 were on and everything was fine after that

Related

I can't ping google.com in GNS3

Good afternoon to all! I ran into a problem when setting up my network. The essence of the problem is that I can't ping the address google.com , but I can ping Google DNS 8.8.8.8 I can't do it on a Cisco IOSv router that is connected to the internet using NAT and also on other devices behind it I can't do it. But to check, I connected a PC and was able to ping google.com . Of course, I tried to set up NAT on the router, prescribed NAT INSIDE and NAT OUTSIDE, but it didn't help. I will also attach all the screenshots to make it clear. Most likely I just missed something.
My network:
enter image description here
NAT settings: enter image description here
Ping to 8.8.8.8 and google.com on PC1 and R1: enter image description here
R1 ip route:
Router#show ip route
Gateway of last resort is 192.168.45.2 to network 0.0.0.0
S* 0.0.0.0/0 [1/0] via 192.168.45.2
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 10.1.1.0/24 is directly connected, GigabitEthernet0/1
L 10.1.1.1/32 is directly connected, GigabitEthernet0/1
192.168.45.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.45.0/24 is directly connected, GigabitEthernet0/0
L 192.168.45.100/32 is directly connected, GigabitEthernet0/0
PC1 config:
PC1> show ip
NAME : PC1[1]
IP/MASK : 192.168.45.129/24
GATEWAY : 192.168.45.2
DNS : 192.168.45.2
DHCP SERVER : 192.168.45.254
DHCP LEASE : 1797, 1800/900/1575
DOMAIN NAME : localdomain
MAC : 00:50:79:66:68:00
LPORT : 10003
RHOST:PORT : 127.0.0.1:10004
MTU: : 1500
R1 config:
Router#show startup-config
version 15.6
hostname Router
no ip domain lookup
ip cef
no ipv6 cef
multilink bundle-name authenticated
redundancy
!
interface GigabitEthernet0/0
ip address 192.168.45.100 255.255.255.0
ip nat outside
ip virtual-reassembly in
duplex auto
speed auto
media-type rj45
!
interface GigabitEthernet0/1
ip address 10.1.1.1 255.255.255.0
ip nat inside
ip virtual-reassembly in
duplex auto
speed auto
media-type rj45
!
ip forward-protocol nd
!
!
no ip http server
no ip http secure-server
ip nat inside source list 100 interface GigabitEthernet0/0 overload
ip route 0.0.0.0 0.0.0.0 192.168.45.2
!
!
access-list 100 permit ip any any
!
control-plane
!
I was given an answer from GNS3 Forum (from Ean Towne
GNS3 Moderator). Here 's what he wrote:
"You have disabled the ability for the router (R1) to DNS lookups, and also have not specified the IP address(es) of the DNS to use"
R1(config)# ip name-server 8.8.8.8 1.1.1.1
R1(config)# ip domain lookup
"People often add the "no ip domain lookup" by default in order to remove failed lookups when making typos. However they do not necessarily think about the effect of the same"
https://www.gns3.com/community/support/i-cant-ping-google-com-in-gns3

How to forward packets between VLANs on Open vSwitch router?

I'm trying to configure an OVS router. I want to achieve that, by adding flows on the OVS router, the devices connected with switch ports (port 2-5) can access to the internet, if the internet cable is inserted into the WAN port (port 1).
My VLAN configuration in file /etc/config/network of the OVS router is:
eth1.1: 0t, 2
eth1.2: 0t, 3
eth1.3: 0t, 4
eth1.4: 0t, 5
eth1.5: 1, 6
The output of ovs-vsctl show is:
root#OpenWrt:~# ovs-vsctl show
84d9ab2f-a3e6-46e3-874f-156ef975d673
Bridge "br0"
Controller "tcp:<an IP address>"
is_connected: true
fail_mode: standalone
Port "eth1.4"
Interface "eth1.4"
Port "eth1.2"
Interface "eth1.2"
Port "eth1.1"
Interface "eth1.1"
Port "br0"
Interface "br0"
type: internal
Port "eth1.3"
Interface "eth1.3"
The truncated output of ifconfig is:
br0: 192.168.3.1
eth0: 192.168.0.105 (There is another home router)
eth1, eth1.1-1.4
As the subnet provides IP prefix of 192.168.3.* and the router itself is assigned IP of 192.168.0., I wonder if it's helpful to add a flow to forward packets from 192.168.3. to 192.168.0.104.
So is it correct if I suppose, a machine with IP 192.168.3.10, for example, it wants to make query to google, the path should be 192.168.3.10->192.168.0.105->192.168.0.1(home router)->outside?
This is to build a flow based on Layer3. But I'm wondering if I can build flows between VLANs? According to my configuration, WAN port is port1, belongs to VLAN 5. Do you think is viable to add flows bidirectionally from VLAN 1 (machine connected) to VLAN 5 and from VLAN 5 to VLAN 1? If so, is there any examples I can flow please?
Another detail. The output of ifconfig shows eth0 interface was assigned IP 192.168.0.105, which means it's connected with my home router (192.168.0.1). So do I need to forward packets between these to IP addresses?
I really appreciate any help.
The following commands add two rules to send packet from VLAN 5 and port 5 to port 1 with VLAN 1 and vice versa:
ovs-ofctl add-flow br0 in_port=5,dl_vlan=5,actions=mod_vlan_vid:1,output:1
ovs-ofctl add-flow br0 in_port=1,dl_vlan=1,actions=mod_vlan_vid:5,output:5
I have solved this problem. Following is the solution.
The main idea is to build a linux bridge connected with OVS bridge, when I need the VLANs to be able talking with outside internet. I can use brctl to operate linux bridge. Firstly I tried:
brctl addbr br-lan
brctl addif br-lan br0
Then all the machine can access to the internet. But unfortunately, only for couple minutes. After that, the router collapsed. I could not access to the OVS router anymore unless I reset it. That could be caused by the incorrect bridge configuration. I tried many ways and finally this one works:
brctl addbr br-lan
ifconfig br-lan 192.168.3.1
brctl addif br-lan br0
ifconfig br0 0.0.0.0
I considered linux bridge br-lan should be originally connected with eth0 (wan). And as I know, br0 could means 'local', with IP address 192.168.3.1. All VLANs talk with this IP address. If I move 'local' to linux bridge which connected with wan port, it should work.
Thanks for everybody who viewed and tried to help me!

Raspberry refuses to change IP

I am running raspin on an Raspberry Pi2 and I have configured it to have a staic IP on eth0 but it never changes it sticks to its DHCP lease. This is what I have in the interfaces-file under networking.
iface eth0 inet static
address 192.168.1.60
gateway 192.168.1.1
netmask 255.255.255.0
Have I done anything wrong? Am I blind? :)
Did you try restarting network?
/etc/init.d/networking restart
Not an answer to your question, but a workaround.
Add a static IP lease rule in your DHCP server, this is going to be your router in most cases.
Try restarting the RPi or network - the edited interfaces file doesn't take effect until you do that. Some routers also don't like you requesting a certain IP, so you can also set it to DHCP on the RPi and configure the router so that it always assigns a certain IP to the device.

setup xen on two phisical interfaces

does anybody know how to setup XEN to use 2 interfaces? I have a subnet of local IPs on eth0 and subnet of external IPs on eth1. I want containers to be as on a dom0: eth0 and eth1 routed respectivly.
Thanks in advance
I'm currently using two NIC interfaces with Xenserver 6.2. I created them using XenCenter, I'm doing exactly what you're asking, using eth0 on all VMS for local connections and eth1 for internet.
How to do it.
If you have the pool created you need to go to the Networking tab, there you can add a network using the "Add Network" button and then follow the wizard.
If you have any more questions, there is a guide from Citrix. http://support.citrix.com/servlet/KbServlet/download/34969-102-704897/reference.pdf
Good luck.
I found solution by myself. I'll discribe it in case of someone need it
So far I had eth0 interface and br0 configured.
On dom0 I add additinal bridge. I call it br1
addbr addbr br1
Then I bind it to physical interface eth1
addif br1 eth1
Next, I am on Debaian, I configure /etc/network as follows
# The loopback network interface
auto lo
iface lo inet loopback
The primary network interface
auto br0
iface br0 inet static
address 172.16.15.240
netmask 255.255.255.0
network 172.16.15.0
gateway 172.16.15.1
broadcast 172.16.15.255
bridge_ports eth0
bridge_stp on
bridge_maxwait 0
bridge_fd 0
auto br1
iface br1 inet static
address 91.135.xxx.xxx
netmask 255.255.255.240
network 91.135.xxx.xxx
broadcast 91.135.xxx.xxx
gateway 91.135.xxx.xxx
bridge_ports eth1
bridge_stp on
bridge_maxwait 0
bridge_fd 0
dns-nameservers 8.8.8.8
Then in config file for container add virtual interface as follows
vif = [ 'ip=172.16.15.243 ,mac=00:16:3E:18:AF:C3,bridge=br0',
'ip=91.135.xxx.xxx ,mac=00:16:3E:DD:2D:00,bridge=br1'
]
That's it. After reboot both dom0 and domN, you will have container connected to phisical interfaces

configure ip for bitnami owncloud virtual appliance

I installed Bitnami owncloud virtual appliance stack on Virtual box and within no time, I was able to sync files to and from this box. However, the main problem with Virtual Box is that the IP address keeps changing when the owncloud instance is powered off and then turned back on - which makes sense. Is there any way to keep the server IP static so that we don't need to configure the clients everytime the IP is changed.
You could change the config (from auto to static) in the following way
sudo vi /etc/network/interfaces (“vi” or “nano”)
iface eth0 inet static
address 192.168.0.100
# your own IP
netmask 255.255.255.0
# network mask
gateway 192.168.0.1
# standard gateway (router)
dns-nameservers 192.168.0.1 8.8.8.8
# DNS (optional)
/etc/init.d/networking restart (restart network)
ifconfig
for the IP addresses check or you “shutdown –h now” (reboot)). Please, keep in mind that multiple copies need multiple IP's. In Virtual Box remember to switch between NAT and Bridge - if required.