Configure 2 nics with static IP, 1 to the internet and one private
Information:
I'm configuring CentOS 7 networking in a server with 2 nic. Network iterfaces are:
em1 which should be connected to a local network by DHCP,
IP: 192.168.0.240
Gateway: 192.168.0.2
Masq.: 255.255.255.0
.
Its config script is
/etc/sysconfig/network-scripts/ifcfg-em1
:
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="dhcp"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="yes"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="em1"
DEVICE="em1"
ONBOOT="yes"
IPV6_PRIVACY="no"
em2 which should be connected to the internet with static ip
IP: 179.94.94.83
Gateway: 179.94.94.81
Masq.: 255.255.255.248
Its config script is
/etc/sysconfig/network-scripts/ifcfg-em2
:
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=em2
DEVICE=em2
ONBOOT=yes
IPADDR=179.94.94.83
GATEWAY=179.94.94.81
DNS1=200.40.30.245
DNS2=200.40.220.245
PROXY_METHOD=none
BROWSER_ONLY=no
PREFIX=29
The problem:
The problem is when both nics (em1 & em2) are connected I can connect using IP 192.168.0.240 but I don't have access using IP 179.94.94.83 or vice versa, depending which one is first plugged, but if only one of them is connected the corresponding IP works normally.
I've been reading:
- https://kindlund.wordpress.com/2007/11/19/configuring-multiple-default-routes-in-linux/
- http://jensd.be/468/linux/two-network-cards-rp_filter
- https://serverfault.com/questions/779786/public-interface-not-listening-by-default-centos-7
but I couldn't find a solution. Here the author refers to NAT configuration http://jensd.be/468/linux/two-network-cards-rp_filter#comment-15119 but anyway I cannot make both connections work simultaneously.
To clear thing up:
1 NIC1 should have a local static IP like 192.168.x.x and NIC2 should have the external static IP 179.x.x.x.
2 It would be great if we could access different services through different networks, ie. SSH using LAN only and HTTP using both (open to the Internet and LAN)
centos ip webserver
add a comment |
Information:
I'm configuring CentOS 7 networking in a server with 2 nic. Network iterfaces are:
em1 which should be connected to a local network by DHCP,
IP: 192.168.0.240
Gateway: 192.168.0.2
Masq.: 255.255.255.0
.
Its config script is
/etc/sysconfig/network-scripts/ifcfg-em1
:
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="dhcp"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="yes"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="em1"
DEVICE="em1"
ONBOOT="yes"
IPV6_PRIVACY="no"
em2 which should be connected to the internet with static ip
IP: 179.94.94.83
Gateway: 179.94.94.81
Masq.: 255.255.255.248
Its config script is
/etc/sysconfig/network-scripts/ifcfg-em2
:
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=em2
DEVICE=em2
ONBOOT=yes
IPADDR=179.94.94.83
GATEWAY=179.94.94.81
DNS1=200.40.30.245
DNS2=200.40.220.245
PROXY_METHOD=none
BROWSER_ONLY=no
PREFIX=29
The problem:
The problem is when both nics (em1 & em2) are connected I can connect using IP 192.168.0.240 but I don't have access using IP 179.94.94.83 or vice versa, depending which one is first plugged, but if only one of them is connected the corresponding IP works normally.
I've been reading:
- https://kindlund.wordpress.com/2007/11/19/configuring-multiple-default-routes-in-linux/
- http://jensd.be/468/linux/two-network-cards-rp_filter
- https://serverfault.com/questions/779786/public-interface-not-listening-by-default-centos-7
but I couldn't find a solution. Here the author refers to NAT configuration http://jensd.be/468/linux/two-network-cards-rp_filter#comment-15119 but anyway I cannot make both connections work simultaneously.
To clear thing up:
1 NIC1 should have a local static IP like 192.168.x.x and NIC2 should have the external static IP 179.x.x.x.
2 It would be great if we could access different services through different networks, ie. SSH using LAN only and HTTP using both (open to the Internet and LAN)
centos ip webserver
add a comment |
Information:
I'm configuring CentOS 7 networking in a server with 2 nic. Network iterfaces are:
em1 which should be connected to a local network by DHCP,
IP: 192.168.0.240
Gateway: 192.168.0.2
Masq.: 255.255.255.0
.
Its config script is
/etc/sysconfig/network-scripts/ifcfg-em1
:
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="dhcp"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="yes"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="em1"
DEVICE="em1"
ONBOOT="yes"
IPV6_PRIVACY="no"
em2 which should be connected to the internet with static ip
IP: 179.94.94.83
Gateway: 179.94.94.81
Masq.: 255.255.255.248
Its config script is
/etc/sysconfig/network-scripts/ifcfg-em2
:
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=em2
DEVICE=em2
ONBOOT=yes
IPADDR=179.94.94.83
GATEWAY=179.94.94.81
DNS1=200.40.30.245
DNS2=200.40.220.245
PROXY_METHOD=none
BROWSER_ONLY=no
PREFIX=29
The problem:
The problem is when both nics (em1 & em2) are connected I can connect using IP 192.168.0.240 but I don't have access using IP 179.94.94.83 or vice versa, depending which one is first plugged, but if only one of them is connected the corresponding IP works normally.
I've been reading:
- https://kindlund.wordpress.com/2007/11/19/configuring-multiple-default-routes-in-linux/
- http://jensd.be/468/linux/two-network-cards-rp_filter
- https://serverfault.com/questions/779786/public-interface-not-listening-by-default-centos-7
but I couldn't find a solution. Here the author refers to NAT configuration http://jensd.be/468/linux/two-network-cards-rp_filter#comment-15119 but anyway I cannot make both connections work simultaneously.
To clear thing up:
1 NIC1 should have a local static IP like 192.168.x.x and NIC2 should have the external static IP 179.x.x.x.
2 It would be great if we could access different services through different networks, ie. SSH using LAN only and HTTP using both (open to the Internet and LAN)
centos ip webserver
Information:
I'm configuring CentOS 7 networking in a server with 2 nic. Network iterfaces are:
em1 which should be connected to a local network by DHCP,
IP: 192.168.0.240
Gateway: 192.168.0.2
Masq.: 255.255.255.0
.
Its config script is
/etc/sysconfig/network-scripts/ifcfg-em1
:
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="dhcp"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="yes"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="em1"
DEVICE="em1"
ONBOOT="yes"
IPV6_PRIVACY="no"
em2 which should be connected to the internet with static ip
IP: 179.94.94.83
Gateway: 179.94.94.81
Masq.: 255.255.255.248
Its config script is
/etc/sysconfig/network-scripts/ifcfg-em2
:
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=em2
DEVICE=em2
ONBOOT=yes
IPADDR=179.94.94.83
GATEWAY=179.94.94.81
DNS1=200.40.30.245
DNS2=200.40.220.245
PROXY_METHOD=none
BROWSER_ONLY=no
PREFIX=29
The problem:
The problem is when both nics (em1 & em2) are connected I can connect using IP 192.168.0.240 but I don't have access using IP 179.94.94.83 or vice versa, depending which one is first plugged, but if only one of them is connected the corresponding IP works normally.
I've been reading:
- https://kindlund.wordpress.com/2007/11/19/configuring-multiple-default-routes-in-linux/
- http://jensd.be/468/linux/two-network-cards-rp_filter
- https://serverfault.com/questions/779786/public-interface-not-listening-by-default-centos-7
but I couldn't find a solution. Here the author refers to NAT configuration http://jensd.be/468/linux/two-network-cards-rp_filter#comment-15119 but anyway I cannot make both connections work simultaneously.
To clear thing up:
1 NIC1 should have a local static IP like 192.168.x.x and NIC2 should have the external static IP 179.x.x.x.
2 It would be great if we could access different services through different networks, ie. SSH using LAN only and HTTP using both (open to the Internet and LAN)
centos ip webserver
centos ip webserver
asked 7 mins ago
Damon HillDamon Hill
3219
3219
add a comment |
add a comment |
0
active
oldest
votes
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f509803%2fconfigure-2-nics-with-static-ip-1-to-the-internet-and-one-private%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f509803%2fconfigure-2-nics-with-static-ip-1-to-the-internet-and-one-private%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown