Difference between revisions of "OPS235 Lab 6 - Fedora17"
Brian.gray (talk | contribs) (→Investigation 4: How do I configure the network without a GUI tool?.) |
Brian.gray (talk | contribs) (→Investigation 4: How do I configure the network without a GUI tool?.) |
||
Line 126: | Line 126: | ||
#* Copy that file to <code>ifcfg-eth1</code> or whatever name matches your current eth interface. | #* Copy that file to <code>ifcfg-eth1</code> or whatever name matches your current eth interface. | ||
#* Edit the new file for you interface and give it the following settings: | #* Edit the new file for you interface and give it the following settings: | ||
− | GATEWAY=192.168.235.1 | + | #**GATEWAY=192.168.235.1 |
− | DNS1=192.168.235.1 | + | #**DNS1=192.168.235.1 |
− | DEVICE=eth1 <-- or the interface name you have | + | #**DEVICE=eth1 <-- or the interface name you have |
− | BOOTPROTO=none | + | #**BOOTPROTO=none |
− | NETMASK=255.255.255.0 | + | #**NETMASK=255.255.255.0 |
− | TYPE=Ethernet | + | #**TYPE=Ethernet |
− | HWADDR=52:54:00:3f:5c:fa <--use the HWADDR for your interface | + | #**HWADDR=52:54:00:3f:5c:fa <--use the HWADDR for your interface |
− | IPADDR=192.168.235.13 | + | #**IPADDR=192.168.235.13 |
− | IPV6INIT=no | + | #**IPV6INIT=no |
− | ONBOOT=yes | + | #**ONBOOT=yes |
− | USERCTL=no | + | #**USERCTL=no |
Revision as of 17:18, 2 March 2010
Contents
- 1 Configuring a Network Using Virtual Machines
- 1.1 Objectives
- 1.2 Reference
- 1.3 Required materials
- 1.4 Current Configuration
- 1.5 Lab Preparation
- 1.6 Lab Investigations
- 1.6.1 Investigation 1: How do you create a new virtual network.
- 1.6.2 Investigation 2: How do you configure a static network using system-config-network.
- 1.6.3 Investigation 3: What files does the system-config-network GUI tool change?.
- 1.6.4 Investigation 4: How do I configure the network without a GUI tool?.
Configuring a Network Using Virtual Machines
Objectives
- Configure a virtual network for Virtual Machines
- Use the Fedora GUI program to configure network interfaces with static IP configuration and host name resolution
- Use the
find
command to locate the configuration files modified by the GUI network configuration program - To examine some of the Linux's TCP/IP configuration files in the
/etc/
directory - To configure a Fedora host with static network configuration without a GUI tool
- To use and interpret the
netstat
command to troubleshoot and monitor network services - To configure the linux firewall
iptables
to allow/disallow/forward different types of network traffic using simple rules
Reference
- man pages for find, ifconfig, ping, netstat, NetworkManager, nslookup, iptables, arp
- Online reading material for week 8.
Required materials
- Fedora 12 Live CD or a classmate on the same pod
- USB flash drive, 64 MB or more in size (Warning: the contents of this drive will be erased)
- One SATA hard disk in a removable drive tray with Fedora host and 3 Fedora Virtual Machines installed
Current Configuration
Currently you should have the following network configuration:
- Fedora host has 1 active network interface (probably
eth0
)that receives IP configuration from the School's DHCP server. - Fedora host has 1 active network interface (
virbr0
) that has a static default configuration of 192.168.122.1/255.255.255.0 - Fedora1 VM has 1 active interface (
eth0
) that receives a dynamic configuration from your Fedora Host - Fedora2 VM has 1 active interface (
eth0
) that receives a dynamic configuration from your Fedora Host - Fedora3 VM has 1 active interface (
eth0
) that receives a dynamic configuration from your Fedora Host
Lab Preparation
Lab Investigations
Investigation 1: How do you create a new virtual network.
Before configuring our network we want to turn off dynamic network configuration for our Virtual Machines by turning off the "default" virtual network.
- On the fedora host start Virtual Machine Manager
- Under Edit->Host Details select the Virtual Networks tab
- Disable the default configuration from starting at boot by deselecting the "Autostart On Boot" checkbox.
- Stop the default network configuration by clicking on the stop button at the bottom of the window.
- Click on the add button to add a new network configuration.
- Give your new network a name (network1)
- Enter in the new network IP address space:
- 192.168.235.0/24
- Disable DHCP by deselecting the check box.
- Enable Network Forwarding by Selecting "Forwarding to physical network"
- The destination should be "Any physical device" and the mode should be "NAT"
- Now we need to add our new virtual network "network1" to the 3 VM's
- Select the fedora1 VM and edit the VM details
- Under View select Details
- In the left pane select the NIC and note that this NIC is on the "default" virtual network
- Click on the Remove button
- Click on "Add Hardware" and add a new network
- For the host device select "Virtual Network network1" : NAT
- Repeat these steps for fedora2 and fedora3 VM's
- Answer the Investigation 1 question in your lab log book.
Investigation 2: How do you configure a static network using system-config-network
.
- Start fedora2 VM and login
- On your fedora host run
ifconfig
and make note of the IP address assigned to thevirbr1
interface. This will be your default gateway for your Vm's. - To configure a new interface on fedora2 go to System->Administration->Network and click on the "New" button
- Select Ethernet Device and choose the network card named
eth1
- Statically set the IP configuration:
- IP Address 192.168.235.12
- Subnet Mask 255.255.255.0
- Default Gateway 192.168.235.1 (The IP address of
virbr1
on your fedora host.)
- Click on the DNS tab and add 192.168.235.1 as the primary DNS server.
- Save then Quit
- Restart your network on fedora2.
service NetworkManager restart
- Verify your new interface by examining the output of
ifconfig
- To verify that fedora2 has the correct default gateway configured, enter the command
route -n
- Verify the network by using
ping 192.168.235.1
- Record the answer to Investigation 2 in your logbook.
Investigation 3: What files does the system-config-network
GUI tool change?.
- Start fedora1 VM and login
- Before we configure fedora1 we should create a timestamp file that can be used to see which files have changed as a result of using the GUI tool.
-
date > /tmp/timestamp
-
- Run the network configuration tool and enter the following static configuration in the same way that you configured fedora2.
- IP Address: 192.168.235.11
- Subnetmask: 255.255.255.0
- Default Gateway: 192.168.235.1
- DNS Server: 192.168.235.1
- Save and quit and restart NetworkManager
- Verify the configuration by pinging fedora host (192.168.235.1) and fedora2 (192.168.235.12)
- To verify that fedora1 has the correct default gateway configured, enter the command
route -n
- Use the
find
command to locate the configuration files modified by the GUI network configuration program- Previously, you created a file called
/tmp/timestamp
. Any files that were modified by the GUI network configuration program should have a timestamp later (or newer) than the "timestamp" file you created. All the Linux TCP/IP configuration files are stored under the "/etc" directory or its sub-directories. The following command when run as root will give you a list of all the files under the/etc
directory with a file modification date newer than the date of the "timestamp" file:find /etc -newer /tmp/timestamp
- Previously, you created a file called
- Capture the output to a file called
netcfg.lst
under user root's home directory. - Create a new directory called
/tmp/lab6
and copy all the files from thefind
command to it.- There are a number of ways to accomplish this:
- Edit
netcfg.lst
and turn it into a bash script. - Copy the files manually using the
cp
command. - Investigate the
-exec
option of thefind
command to see how to find and copy the files with a single command.
- Edit
- There are a number of ways to accomplish this:
- Record the answer to the investigation in your lab log.
Investigation 4: How do I configure the network without a GUI tool?.
- Start fedora3 VM and login as root
- Use the command
ifconfig
to list active interfaces, you should see one with a name ofeth1
or a similar name. - To configure your card with a static address use the command:
-
ifconfig eth1 192.168.235.13 netmask 255.255.255.0
-
- To configure a default gateway for that interface enter the command:
-
route add default gw 192.168.235.1
-
- To configure your DNS server edit the file
/etc/resolv.conf
. Change thenameserver
line to be:-
nameserver 192.168.235.1
-
- Confirm your settings work by doing the following:
-
ifconfig
-
route -n
-
ping
your other VM's and fedora host. -
ssh
to your matrix account to test DNS
-
- Restart the
fedora3
VM - Login and test your configuration again. What happened?
- While we can configure network settings from the command line those settings are not persistent. To configure persistent network configurations we need to edit the configuration files:
- Change to the
/etc/sysconfig/network-scripts
directory onfedora3
- List the contents of the directory and you should see 2 different types of files, network config scripts and network configuration files.
- look for the config file for your original interface, it should be named
ifcfg-eth0
- Copy that file to
ifcfg-eth1
or whatever name matches your current eth interface. - Edit the new file for you interface and give it the following settings:
- GATEWAY=192.168.235.1
- DNS1=192.168.235.1
- DEVICE=eth1 <-- or the interface name you have
- BOOTPROTO=none
- NETMASK=255.255.255.0
- TYPE=Ethernet
- HWADDR=52:54:00:3f:5c:fa <--use the HWADDR for your interface
- IPADDR=192.168.235.13
- IPV6INIT=no
- ONBOOT=yes
- USERCTL=no
- Change to the