LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 08-04-2013, 04:06 PM   #1
AudioMechanic
Member
 
Registered: Jun 2003
Distribution: OpenSUSE 12.3, CentOS 6, Xubuntu 13.04
Posts: 125

Rep: Reputation: 16
Internet Sharing on CentOS


Hi everyone. Have a CentOS 6.4 server with 2 NICs and need help with sharing the internet connection with my internal network. Tried much but am stumped. I can ping eth1 and eth0 from another machine on my network, but I cannot access outside of that.

eth0 = internet/public - address is DHCP assigned by my ISP
eth1 = internal/private - address is STATIC

Here are my config files:

/etc/sysconfig/network-scripts/eth0

Code:
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:21:5E:4E:8F:C2
ONBOOT=yes
/etc/sysconfig/network-scripts/eth1

Code:
DEVICE=eth1
BOOTPROTO=static
HWADDR=00:21:5E:4E:8F:C3
IPADDR=10.10.69.1
NETMASK=255.255.255.0
ONBOOT=yes
TYPE=Ethernet
/etc/sysconfig/network

Code:
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=localhost.localdomain
/etc/sysconfig/iptables

Code:
# Generated by iptables-save v1.4.7 on Sun Aug  4 15:25:53 2013
*nat
:PREROUTING ACCEPT [1:229]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A POSTROUTING -o eth0 -j MASQUERADE
-A POSTROUTING -s 10.10.69.0/24 -o eth0 -j MASQUERADE
COMMIT
# Completed on Sun Aug  4 15:25:53 2013
# Generated by iptables-save v1.4.7 on Sun Aug  4 15:25:53 2013
*filter
:INPUT ACCEPT [27749:38830498]
:FORWARD DROP [1:76]
:OUTPUT ACCEPT [14565:779782]
COMMIT
# Completed on Sun Aug  4 15:25:53 2013
# Generated by iptables-save v1.4.7 on Sun Aug  4 15:25:53 2013
*mangle
:PREROUTING ACCEPT [27750:38830574]
:INPUT ACCEPT [27749:38830498]
:FORWARD ACCEPT [1:76]
:OUTPUT ACCEPT [14565:779782]
:POSTROUTING ACCEPT [14565:779782]
COMMIT
# Completed on Sun Aug  4 15:25:53 2013
Code:
[root@localhost sysconfig]# cat /proc/sys/net/ipv4/ip_forward
1
[root@localhost sysconfig]#
Code:
[shane@localhost ~]$ cat /etc/resolv.conf
; generated by /sbin/dhclient-script
nameserver 208.67.222.222
nameserver 208.67.220.220
[shane@localhost ~]$
Code:
[root@localhost ~]# cat /etc/sysctl.conf
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled.  See sysctl(8) and
# sysctl.conf(5) for more details.

# Controls IP packet forwarding
net.ipv4.ip_forward = 1
#net.ipv4.conf.default.fowarding = 1

# Controls source route verification
net.ipv4.conf.default.rp_filter = 1

# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0

# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0

# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1

# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1

# Disable netfilter on bridges.
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0

# Controls the default maxmimum size of a mesage queue
kernel.msgmnb = 65536

# Controls the maximum size of a message, in bytes
kernel.msgmax = 65536

# Controls the maximum shared segment size, in bytes
kernel.shmmax = 68719476736

# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296
[root@localhost ~]#
Ping from server console:
Code:
[root@localhost ~]# ping 4.2.2.2
PING 4.2.2.2 (4.2.2.2) 56(84) bytes of data.
64 bytes from 4.2.2.2: icmp_seq=1 ttl=57 time=169 ms
64 bytes from 4.2.2.2: icmp_seq=2 ttl=57 time=68.5 ms
64 bytes from 4.2.2.2: icmp_seq=3 ttl=57 time=74.5 ms
64 bytes from 4.2.2.2: icmp_seq=4 ttl=57 time=70.3 ms
^C
--- 4.2.2.2 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3153ms
rtt min/avg/max/mdev = 68.514/95.823/169.933/42.844 ms
[root@localhost ~]#
Ping from laptop inside the network returns:
Code:
--- 4.2.2.2 ping statistics ---
10 packets transmitted, 0 received, 100% packet loss, time 8999ms
This is driving me crazy. Please help.

Thank you in advance!

Last edited by AudioMechanic; 08-04-2013 at 04:08 PM.
 
Old 08-04-2013, 04:11 PM   #2
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
i think this will get you on your way:
http://www.linuxquestions.org/questi...6/#post3804866
 
Old 08-04-2013, 04:41 PM   #3
AudioMechanic
Member
 
Registered: Jun 2003
Distribution: OpenSUSE 12.3, CentOS 6, Xubuntu 13.04
Posts: 125

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by schneidz View Post
i think this will get you on your way:
http://www.linuxquestions.org/questi...6/#post3804866
Thank you for your reply.

From the looks of the command he ran, the only one I don't currently have on my system is:

Code:
route add  -net 192.168.10.0  netmask 255.255.255.0 gw 192.168.5.1 dev eth0
Which I edited to my machine's setup:

Code:
[root@localhost ~]# route add -net 10.10.69.0 netmask 255.255.255.0 gw 192.168.15.1 dev eth1
SIOCADDRT: No such process
[root@localhost ~]#
 
Old 08-04-2013, 05:04 PM   #4
AudioMechanic
Member
 
Registered: Jun 2003
Distribution: OpenSUSE 12.3, CentOS 6, Xubuntu 13.04
Posts: 125

Original Poster
Rep: Reputation: 16
I GOT IT!!! But I don't know if this is a safe config. I changed the line in iptables from:

Code:
-A FORWARD -m state -i eth1 -o eth0 --state ESTABLISHED,RELATED -j ACCEPT
to:

Code:
-A FORWARD -m state -i eth1 -o eth0 --state UNTRACKED -j ACCEPT
And now it's working!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Sharing internet connection(wireless server internet, wired network client) vladimir1986 Linux - Networking 4 07-25-2011 10:34 AM
CentOS 5 Internet sharing and DHCP Help DavM Linux - Newbie 5 11-06-2009 08:05 PM
Internet Access & Internet Sharing Through Wi-Fi. Be.Gurmeet.Be Linux - Networking 0 04-13-2006 03:07 PM
mandrake 10.1 sharing files and internet sharing xfiles_arram Linux - Networking 0 05-21-2005 02:22 PM
File sharing and internet sharing mullet Linux - Networking 1 10-14-2003 01:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration